-
Notifications
You must be signed in to change notification settings - Fork 199
Use config.assests.js_compressor setting for save original js compressor #206
base: master
Are you sure you want to change the base?
Conversation
@aar0nTw Could you add a |
Hi @carsomyr: It already has I think it has no need to add attribute in requirejs rails config, We just need get the current sprocket compressor object, because the |
@aar0nTw My main concern is clarity: The code in the Rake tasks refers to |
If user doesn't set the `config.requirejs.js_compressor, use js_compressor of Sprockets in default.
@carsomyr updated, please check it |
Can we get this merged? |
@agis- Ok, I'll take a look at this again. |
Run into the same issue too, using requirejs-rails 1.9.5, rails 4.2, sprockets 2.12.4 and sprockets-rails. @aar0nTw Are you using this patch in production? |
Also interested in this (requirejs-rails-0.9.9 / rails 4.2). |
When I set
config.assets.js_compressor
to compressor with some custom options likeUglifier.new(mangle: false)
The precompile task always get the error:
Sprockets::Error: unknown compressor: js_compressor
, there's because Sprocket::Environment will return:js_compressor
symbol when we want to getRails.application.assets.js_compressor
value if user set compressor to specific compressor object , please see https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/compressing.rb#L60and when the task want to put
orignal_js_compressor
back toenv.js_compressor
, Sprocket can't find any compressor source name:js_compressor
and throw error.So it should be cache the
Rails.application.config.assets.js_compressor
(A real compressor object) tooriginal_js_compressor
notRails.application.assets.js_compressor
.ref #201