File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,15 @@ class Engine < ::Rails::Engine
3737 config . assets . paths << root . join ( 'vendor' , 'assets' , 'stylesheets' ) . to_s
3838
3939 if Rails . env . production? || Rails . env . test?
40- # Workaround rails 7 + es6 syntax in some js causing uglifier errors by running harmony mode
41- # See: https://www.github.com/lautis/uglifier/issues/127
42- require 'uglifier'
43- config . assets . js_compressor = Uglifier . new ( :harmony => true )
40+ config . assets . configure do |env |
41+ # Workaround rails 7 + es6 syntax in some js causing uglifier errors by running harmony mode
42+ # See: https://www.github.com/lautis/uglifier/issues/127
43+ # Note, we're purposely using our own compressor to avoid requiring uglifier at application boot time
44+ # since this require a js runtime such as node.
45+ require 'manageiq/ui/classic/js_compressor'
46+ env . register_compressor 'application/javascript' , :manageiq_ui_classic_js_compressor , ManageIQ ::UI ::Classic ::JsCompressor
47+ end
48+ config . assets . js_compressor = :manageiq_ui_classic_js_compressor
4449 end
4550
4651 def self . vmdb_plugin?
Original file line number Diff line number Diff line change 1+ module ManageIQ
2+ module UI
3+ module Classic
4+ class JsCompressor < Sprockets ::UglifierCompressor
5+ def initialize ( options = { } )
6+ warn "\e [33m** Using #{ self . class . name } with Uglifier.new(:harmony => true) from: #{ __FILE__ } :#{ __LINE__ } \e [0m"
7+ options [ :harmony ] = true
8+ super ( options )
9+ end
10+ end
11+ end
12+ end
13+ end
You can’t perform that action at this time.
0 commit comments