Make Asset Compression On Production Work With Angular Js

Posted by Weston Ganger on July 16, 2014

For AngularJS and likely others too, the javascript minification changes variable names to short names. This must be changed although it will make your minification slightly less minified, its the way it must be done so that it works on production.

Edit your config/environments/production.rb

The old Rails 3 way of doing it was:

config.assets.js_compressor = Sprockets::LazyCompressor.new { Uglifier.new(:mangle => false) 

The new Rails 4 way:

config.assets.js_compressor = Uglifier.new(:mangle => false)

Posted in Rails and Tagged with rails angularjs minification 

Want me to help develop your next project or application?

Contact Us

Specializing in Ruby-on-Rails, Javascript, Multi-Platform Electron Desktop Apps and Hybrid Cordova Mobile Apps.

Recommended Posts