mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
DEV: Use Terser for JS minification/compression if available (#12656)
This commit is contained in:
parent
b7dad91f2f
commit
e77b9dfd45
@ -97,8 +97,11 @@ def compress_node(from, to)
|
|||||||
source_map_url = cdn_path "/assets/#{to}.map"
|
source_map_url = cdn_path "/assets/#{to}.map"
|
||||||
base_source_map = assets_path + assets_additional_path
|
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
|
cmd = <<~EOS
|
||||||
uglifyjs '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}'"
|
#{js_compressor} '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}'"
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
STDERR.puts cmd
|
STDERR.puts cmd
|
||||||
|
Loading…
Reference in New Issue
Block a user