Description: use htmlmin instead of html-minifier-terser missing in Debian
Author: Jonas Smedegaard <dr@jones.dk>
Last-Update: 2020-10-14
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/emcc.py
+++ b/emcc.py
@@ -3646,36 +3646,13 @@
   opts = []
   # -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',
-             '--sort-class-name']
-  # -g2 and greater do not minify HTML at all
-  if settings.DEBUG_LEVEL <= 1:
-    opts += ['--decode-entities',
-             '--collapse-boolean-attributes',
-             '--remove-attribute-quotes',
-             '--remove-redundant-attributes',
-             '--remove-script-type-attributes',
-             '--remove-style-link-type-attributes',
-             '--use-short-doctype',
-             '--minify-css', 'true',
-             '--minify-js', 'true']
-
-  # html-minifier also has the following options, but they look unsafe for use:
-  # '--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.
-  #                              (Breaks at least browser.test_asmfs_hello_file)
-  # '--remove-empty-elements': removes all elements with empty contents.
-  #                            (Breaks at least browser.test_asm_swapping)
+    opts += ['--remove-empty-space',
+             '--remove-comments']
 
   logger.debug(f'minifying HTML file {filename}')
   size_before = os.path.getsize(filename)
   start_time = time.time()
-  shared.check_call(shared.get_npm_cmd('html-minifier-terser') + [filename, '-o', filename] + opts, env=shared.env_with_node_in_path())
+  shared.check_call(['htmlmin', opts, '--', filename, filename])
 
   elapsed_time = time.time() - start_time
   size_after = os.path.getsize(filename)
