html-minifier
html-minifier copied to clipboard
Minifier fails to parse a JavaScript for loop
Minifying the following JavaScript code
"use strict";
function test() {
for(let i = 0; i < arguments.length; i++) {
console.log("Argument " + i + " : " + arguments[i]);
}
}
test();
using the following command line call:
/usr/local/bin/html-minifier --collapse-whitespace \
--remove-comments \
--remove-optional-tags \
--remove-redundant-attributes \
--remove-script-type-attributes \
--remove-tag-whitespace \
--use-short-doctype \
--minify-css true \
--minify-js true \
--output test.min.js \
test.js
fails with the following error:
Minification error:
Parse Error: < arguments.length; i++) {
for(let i = 0; i < arguments.length; i++) {
console.log("Argument " + i + " : " + arguments[i]);
}
}
As far as I can tell the code should minify but simply does not.
Have same issue. Code: for (let row = 0; row < mapa.length; row++) {
Error: Parse Error: < mapa.length; row++) {
html-minifier \
--collapse-whitespace \
--remove-comments \
--remove-optional-tags \
--remove-redundant-attributes \
--remove-script-type-attributes \
--remove-tag-whitespace \
--use-short-doctype \
--minify-css true \
--minify-js true \
-o docs\script.js \
src\script.js
This package can't handle ES6. You should look at html-minifier-terser instead.