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

incorrectly removes whitespace before CSS wildcard selector

Open dwhieb opened this issue 3 years ago • 1 comments

In Elad Shechter's new CSS reset, he uses the following lines of CSS:

*:where(:not(iframe, canvas, img, svg, video):not(svg *)) {
  all: unset;
  display: revert;
}

html-minifier converts :not(svg *) to :not(svg*), which is invalid CSS and prevents the rule from being applied.

I've confirmed that this error is not caused by clean-css—it's caused by html-minifier.

I haven't been able to find any setting in html-minifier that I can adjust to fix this, except to use ignoreCustomFragments, which seems hacky.

It seems like html-minifier should not be removing whitespace in this instance.

dwhieb avatar Apr 18 '22 19:04 dwhieb

If of interest, this should work in HTML Minifier Next (maintained successor) via its recent switch to Lightning CSS.

j9t avatar Nov 26 '25 15:11 j9t