I'd like to selectively compress some of the javascript files in a Rails 3.2 app, but still have all js assets served from a single bundled file in the production environment.
Syntax like this, inside of the app/assets/javascripts/application.js file, using the made-up :compress => false
option passed to the last 3 sprockets require
directives I hope explains what I'm trying to achieve.
// Contents of app/assets/javascripts/application.js // //= require jquery //= require jquery_ujs //= require angular-1.0.1/angular, :compress => false //= require angular-1.0.1/angular-resource, :compress => false //= require products, :compress => false
So jquery.js and jquery_ujs.js files will be compressed (by Rails asset compilation, which uses UglifierJS by default), and the remaining 3 files will not be compressed, but they will be bundled into the application.js bundle.
Is there any way available to do this?
The motivation is that the products.js file contains an angularjs controller that makes use of angular's dependency injection which requires specific variable names such as $scope
and $http
are not altered.