Posted by flyerhzm on November 23, 2012
Rails is integrated with sprockets from 3.1, which gives you the power to pre-process, compress and minify your assets. It's awesome, but it slows down deployment a lot.
then all assets precompiling stuff will be done during deployment.
But assets precompile is significantly slow, it consumes a lot of cpu resources, you have to wait much longer time for capistrano deployment. But sometimes I just added a hotfix for backend code or fix a typo on html, it still precompile all assets no matter if any asset files are changed.
There are several solutions:
1. override the default deploy:assets:precomple task by yourself, compare the new asset files with old asset files, if there are no changes, skip the asset:precomple task. Here is an example: https://gist.github.com/3072362
2. thank @ndbroadbent for releasing a gem turbo-sprockets-rails3, it's smarter and only recompiling changed assets. It's also simpler, what you need to do is add turbo-sprockets-rails3 gem to your Gemfile, then enjoy speeding up deployment.