Nithin Bekal

Posts About Notes Slides

Enable Asset Compression After Upgrading to Rails 4

28 Nov 2014

Recently, I upgraded an app from Rails 3.2 to 4.0. Things went smoothly, but I recently noticed that the JavaScript response was twice the size I expected it to be. Taking a closer look showed that Rails was no longer minifying the JS assets.

It turns out that the config.assets.compress = true directive no longer works in Rails 4. Instead, you need to specify the compressor in config/environment/production.rb like this:

MyApp::Application do
  config.assets.js_compressor = :uglifier

It is strange that this was changed without any deprecation messages, but luckily it didn’t cause much damage.

Hi, I’m Nithin Bekal, a software craftsman with over 7 years of experience in shipping web applications. I mostly use Ruby, but lately have also been exploring Elixir. Co-founder of, and helping organize Rubyconf India. Tweet to me at @nithinbekal.