How to use the Rails asset pipeline in development mode

For debugging purposes, it can be useful to use the Rails asset pipeline in development as if it were production, with concatenated assets served out of public/assets.

To do this, add these lines to config/environments/development.rb:

 config.assets.debug = false
 config.assets.compile = false
 config.assets.digest = true
 

Make sure config.assets.debug = true (the default setting) is disabled or above this code.

Restart your server, then run rake assets:precompile. You should now be serving concatenated assets with digest cache breakers, which is the default for production.

I had to do this yesterday, but I couldn’t find the answer in one place. I hope this is helpful for someone.