minify-html icon indicating copy to clipboard operation
minify-html copied to clipboard

HTML comments minified improperly

Open Rongronggg9 opened this issue 2 years ago • 2 comments

original:

<p><!----> <!----> <!----> <!----> <!----> <!----> <!----></p>

minified:

Cfg result intended
(default) <p>⬜⬜⬜⬜ <p>
keep_comments <p><!----><!---->⬜<!---->⬜<!---->⬜<!---->⬜<!----><!----> <p><!----><!----><!----><!----><!----><!----><!----></p> ~(or <p><!----><!----><!----><!----><!----><!----><!---->?)~
keep_closing_tags <p>⬜⬜⬜⬜</p> <p></p>
keep_comments, keep_closing_tags <p><!----><!---->⬜<!---->⬜<!---->⬜<!---->⬜<!----><!----></p> <p><!----><!----><!----><!----><!----><!----><!----></p>

(Spaces will be trimmed by GitHub in some conditions, so I replaced them with )

FYI: Python 3.10.1 (tags/v3.10.1:2cd268a, Dec 6 2021, 19:10:37) [MSC v.1929 64 bit (AMD64)] on win32 minify-html 0.8.0

Rongronggg9 avatar Feb 26 '22 19:02 Rongronggg9

Good points, thanks for raising. There have been issues I've encountered with comments and minification, as minify-html parses sequentially and does not build a tree for performance and memory reasons. I will investigate ways to work around comments, but if they're too complex or slow, I may simply remove the option to keep comments.

wilsonzlin avatar Mar 22 '22 01:03 wilsonzlin

I consider that simply removing the option to keep comments is acceptable. Thanks for your work!

Rongronggg9 avatar Mar 22 '22 04:03 Rongronggg9