Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pipeline assets precompile disable does not seem to work

I have disabled pipeline assets precompile. For that I have the following line in my config/application.rb & config/environments/development.rb

config.assets.enabled = false

I am trying to deploy in development environment with Capistrano3. When I run deploy command I find assets are precompiled.

$cap development deploy --trace

DEBUG [8b4a938e] Command: cd /home/ec2-user/capistrano-3/a/releases/20140122054901 && ( RAILS_ENV=development ~/.rvm/bin/rvm 2.0.0-p353 do bundle exec rake assets:precompile )
DEBUG [8b4a938e]    /home/ec2-user/.rvm/rubies/ruby-2.0.0-p353/bin/ruby /home/ec2-user/capistrano-3/ano_dev/shared/bundle/ruby/2.0.0/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets
DEBUG [8b4a938e]    
INFO [8b4a938e] Finished in 8.812 seconds with exit status 0 (successful).

What else I need to do to avoid assets pre compilation. It further gives

like image 364
user3205523 Avatar asked Jan 22 '14 07:01

user3205523


People also ask

What does rake assets Precompile do?

rake assets:precompile. We use rake assets:precompile to precompile our assets before pushing code to production. This command precompiles assets and places them under the public/assets directory in our Rails application.

How does asset pipeline work?

The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages and pre-processors such as CoffeeScript, Sass, and ERB.

What is the command for Precompiling assets before deploying a Rails app?

To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.


2 Answers

What's in your Capfile?

If you have

require 'capistrano/rails'

then it will precompile your assets because capistrano/rails also includes bundler, rails/assets and rails/migrations.

https://github.com/capistrano/rails/blob/master/lib/capistrano/rails.rb https://github.com/capistrano/rails/blob/master/lib/capistrano/tasks/assets.rake

If you still want bundler and migrations but not assets, you can include them individually in your Capfile, just make sure you don't still require 'capistrano/rails':

require 'capistrano/bundler'
require 'capistrano/rails/migrations'
like image 77
joshlatte Avatar answered Sep 22 '22 23:09

joshlatte


For my case, our team uses a shared gem for all of our Rails apps, and the shared gem requires 'capistrano/rails' (thus bringing in the assets compilation). For the app that did not handle this, all we did was add:

set :assets_roles, []

in config/deploy.rb and this makes capistrano-rails skip asset precompilation.

like image 20
rusty Avatar answered Sep 21 '22 23:09

rusty