This answer applies for rails 4
One of the reasons when rails-4 won't minify assets is when the RAILS_ENV is not set to production.
This usually happens when you pre-compile assets and run webrick in prod mode using:
rails s -e 'production'
but still the resulting application.css and application.js are concatenated but not minified.
To solve this, use the following to specify the env while precompiling assets:
$ RAILS_ENV=production bundle exec rake assets:precompile
Also if you are upgrading from rails 3 to rails 4, please note that config.assets.compress = true
directive in production.rb is not longer effective for rails 4. You'll need to add the following directives in your config/environments/production.rb
file for it to minify js and css files:
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier # make sure the 'uglifier' gem is included before adding this line
config.assets.css_compressor = :sass # if you are using the sass-rails gem, this line is unnecessary