From 0a3e825fbb44aa0308046847e0ae524b2bbbae7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Fri, 9 Aug 2024 11:28:50 +0300 Subject: [PATCH] Remove the use of --collapse-inline-tag-whitespace pass, which results in too eager whitespace minification on minified HTML pages. Fixes https://github.com/emscripten-core/emscripten/issues/22188. See also https://github.com/terser/html-minifier-terser/issues/179. --- tools/link.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/link.py b/tools/link.py index e35b0d00808cf..e842fe81e310d 100644 --- a/tools/link.py +++ b/tools/link.py @@ -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', @@ -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. and tags from the page. # (Breaks at least browser.test_sdl2glshader) # '--remove-empty-attributes': removes all attributes with whitespace-only values.