A short note about a problem I had getting Capistrano to precompile assets …
I’m using Rails 4 and Capistrano 3 and the instructions for precompiling assets on the production server confused me ! The command cap production deploy does not precompile the Rails assets (Javascript and CSS). The Capfile generated by the ‘capify’ command contains something like this;
1 |
<span style="color: #333399;"> # For documentation on these, see for example:</span> |
1 |
<span style="color: #333399;"> # https://github.com/capistrano/rails/tree/master/assets (Note: does not exist!)</span> |
1 |
<span style="color: #333399;"> # require 'capistrano/rails/assets'</span> |
The link to github does not exist, but this one does, https://github.com/capistrano/rails/
So I uncommented the line
1 |
<span style="color: #333399;"> require 'capistrano/rails/assets'</span> |
and added gem ‘capistrano-rails’ to the Gemfile.
Then deployed the app and ran an extra cap task to precompile the assets. I can’t think when I’d want to deploy without doing a precompile.
cap production deploy
cap production deploy:compile_assets