Using Angular.js and Uglify in Rails?
If your models use Angular dependency magic, like:
function HelloController($scope, $http) {
// ...
}
Don't forget to add:
config.assets.js_compressor = Uglifier.new(mangle: false) if defined? Uglifier
Or explicitly use HelloController.$inject = ['$scope', '$http'].
Written by Łukasz Niemier
Related protips
3 Responses
Uglify.new should be Uglifier.new
over 1 year ago
·
Or more precisely:
config.assets.js_compressor = Uglifier.new(:beautify => true) if defined? Uglifier
over 1 year ago
·
thanks for sharing, i had the same case, after production deployment it was showing up some weird error. 't' module was not loaded. so later disabling mangling solved the problem.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#