How to speed up assets:precompile
The `rake assets:precompile` task is used in Rails 3.1+ to generate asset files in production. However, if you look in the `public/assets` directory, you'll see that for every asset it generates both `file-.js` and `file.js` (and their `.gz` versions). The non-digest file is meant as a fallback for the cases where someone wants to refer to the file without its hash - but this is not recommended anyway, because these files will be cached by the browser and then might not be refreshed when you put a new version on the server under the same name. If you're sure that you're using asset path helpers everywhere and you don't need the non-digest files, use this task instead: RAILS_ENV=production rake assets:precompile:primary This will only generate the digest versions of assets and will take 50% less time. The `RAILS_ENV` is necessary here - `assets:precompile` adds it automatically, but `assets:precompile:all` doesn't, so if you don't add it, it will run in development mode and will only generate non-digest files. Check out also [this article](http://psionides.eu/2012/05/06/extending-asset-pipeline-with-custom-preprocessors/) to see how to make it easier to generate asset paths in your Javascript files.






