kangax / html-minifier

Javascript-based HTML compressor/minifier (with Node.js support)
http://kangax.github.io/html-minifier/
MIT License
4.94k stars 571 forks source link

removeRedundantAttributes seems to be enabled by default #1080

Open adriaandotcom opened 4 years ago

adriaandotcom commented 4 years ago

When running

NODE_ENV=production ./node_modules/.bin/node-minify --compressor html-minifier --input './static/index.html' --output './static/index.html' --option '{"collapseWhitespace": true, "collapseInlineTagWhitespace": true, "preserveLineBreaks": true, "removeScriptTypeAttributes": true, "conservativeCollapse": true }'

I do get a file where type="text" is removed from input elements.

When I run

NODE_ENV=production ./node_modules/.bin/node-minify --compressor html-minifier --input './static/index.html' --output './static/index.html' --option '{"collapseWhitespace": true, "collapseInlineTagWhitespace": true, "preserveLineBreaks": true, "removeScriptTypeAttributes": true, "conservativeCollapse": true, "removeAttributeQuotes": false, "removeRedundantAttributes": false  }'

It's not the case and it works like expected.

The readme shows is should be disable by default, but this is not the case: https://github.com/kangax/html-minifier/commit/9802dfe2b29c5a60c7de3df1897bdad1889494f6#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R41

DanielRuf commented 3 years ago

Your example does not use removeRedundantAttributes but removeAttributeQuotes. Is this really the code that you have used?

adriaandotcom commented 3 years ago

Thanks for taking the time. I meant removeRedundantAttributes indeed. Updated above comment.