I have a Rails project where a newly added javascript file (plotly.min.js
) is causing rake assets:precompile
to hang indefinitely in production mode only. Since the problem is related to javascript compression, I would like to enable verbose logging for Uglifier. I can see that this is possible for the UgligyJS2 command line tool, but my question is how to enable this from my Rails app, preferable in an initializer or the like. I can solve the issue by changing my javascript compressor to closure-compiler
, but I would like to identify the problem with uglifier.
Asked
Active
Viewed 613 times
2

ronan_mac
- 428
- 7
- 16
2 Answers
0
You need to override the sprockets logger in the initializer:
if Rails.env.production?
Rails.application.assets.logger = Logger.new($stdout)
# This sets the log level to debug
Rails.application.assets.logger.level = 0
end

Yury Lebedev
- 3,985
- 19
- 26
-
Unfortunately that doesn't make any difference to the command output. Using `--trace` I get as far as `Execute assets:precompile` before it gets stuck. – ronan_mac Nov 23 '15 at 12:14
-
I suppose you are talking about capistrano output? I just thought that `RAILS_ENV=production bin/rake assets:precompile` does not work for you locally – Yury Lebedev Nov 23 '15 at 12:26
-
No, it's nothing to do with Capistrano. I'm just running the command locally on my machine and it's failing to complete. – ronan_mac Nov 23 '15 at 12:30
0
Sadly I don't have a proper answer to this problem either (I solved it for now by disabling the uglifier in production):
# Compress JavaScripts and CSS.
# KT TODO: reenable js compression
# config.assets.js_compressor = :uglifier
... but just to confirm that I ran into the same problem with uglifier and plotly.js.

Kevin Trowbridge
- 290
- 3
- 6
-
I'd suggest trying the closure compiler instead, it was able to compile without errors for me. – ronan_mac Jan 13 '16 at 06:34