Skip to content

Commit

Permalink
Remove the use of --collapse-inline-tag-whitespace pass, which result…
Browse files Browse the repository at this point in the history
…s in too eager whitespace minification on minified HTML pages. Fixes emscripten-core#22188. See also terser/html-minifier-terser#179.
  • Loading branch information
juj committed Aug 9, 2024
1 parent 08f5c0f commit 0a3e825
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2589,7 +2589,6 @@ def minify_html(filename):
# -g1 and greater retain whitespace and comments in source
if settings.DEBUG_LEVEL == 0:
opts += ['--collapse-whitespace',
'--collapse-inline-tag-whitespace',
'--remove-comments',
'--remove-tag-whitespace',
'--sort-attributes',
Expand All @@ -2607,6 +2606,10 @@ def minify_html(filename):
'--minify-js', 'true']

# html-minifier also has the following options, but they look unsafe for use:
# '--collapse-inline-tag-whitespace': removes whitespace between inline tags in visible text,
# causing words to be joined together. See
# https://github.com/terser/html-minifier-terser/issues/179
# https://github.com/emscripten-core/emscripten/issues/22188
# '--remove-optional-tags': removes e.g. <head></head> and <body></body> tags from the page.
# (Breaks at least browser.test_sdl2glshader)
# '--remove-empty-attributes': removes all attributes with whitespace-only values.
Expand Down

0 comments on commit 0a3e825

Please sign in to comment.