kangax / kangax/html-minifier

Minifier fails to parse a JavaScript for loop

Open
#1,087 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5k
Forks
577
PR merge metrics
No merged PRs in 30d

Description

Minifying the following JavaScript code

````javascript
"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:

````shell
/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.