Closed zw963 closed 3 years ago
For more detail, please check my app on https://github.com/zw963/marketbet_crawler
Sorry, it works, because i am not set RACK_ENV=production, and must specify js_compressor like this:
plugin :sprockets, precompile: ['app.js', 'app.scss'],
public_path: 'public/',
opal: true,
js_compressor: Uglifier.new(:harmony => true),
debug: ENV['RACK_ENV'] != 'production'
Hi, @hmdne , i spent hours for find out why js_compressor options not work when RACK_ENV is not set to production
.
I test use another JS library (terser), it same behavior as uglifier.
I check almost all of the source code of roda-sprockets
, sprockets
gem, try to find out if somewhere have
a condition statement for indicate current assets precompile should use minify and others options, but no luck,
If you have time, could you please give me some clue about this?
@zw963 It should have been documented certainly or the debug mode should be disabled automatically when building assets.
@zw963 It should have been documented certainly or the debug mode should be disabled automatically when building assets.
No, it not controlled by debug option, following is my new config:
plugin :sprockets, precompile: ['app.js', 'app.scss'],
public_path: 'public/',
opal: true,
js_compressor: Terser.new,
debug: true # => set debug always true.
if i set RACK_ENV to production to run rack task, i will generated minified version, if not, will generate normal version. so, it only controlled by this ENV.
You are right! I will correct this behavior in the next commit
Following is my roda plugin config
i change above uglify to
"uglifier"
,:uglifier
,:uglify
, both of the not work, after runrake assets:precompile
, i only get a compiled js file without minify, like this.