mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 06:04:11 +08:00
FIX: Use Terser for minification even if uglify-js is not available (#13683)
This commit is contained in:
parent
1fb48fc9a6
commit
7e52eada20
|
@ -18,7 +18,7 @@ task 'assets:precompile:before' do
|
|||
# is recompiled
|
||||
Emoji.clear_cache
|
||||
|
||||
if !`which uglifyjs`.empty? && !ENV['SKIP_NODE_UGLIFY']
|
||||
if !`which terser`.empty? && !ENV['SKIP_NODE_UGLIFY']
|
||||
$node_uglify = true
|
||||
end
|
||||
|
||||
|
@ -102,11 +102,8 @@ def compress_node(from, to)
|
|||
source_map_url = cdn_path "/assets/#{to}.map"
|
||||
base_source_map = assets_path + assets_additional_path
|
||||
|
||||
# TODO: Remove uglifyjs when base image only includes terser
|
||||
js_compressor = `which terser`.empty? ? 'uglifyjs' : 'terser'
|
||||
|
||||
cmd = <<~EOS
|
||||
#{js_compressor} '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}'"
|
||||
terser '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}'"
|
||||
EOS
|
||||
|
||||
STDERR.puts cmd
|
||||
|
|
Loading…
Reference in New Issue
Block a user