Closed bennypowers closed 3 years ago
workaround:
postcss-clean
from postcss.config.js
minifyLitHtml
rollup plugin like so : minifyLitHtml({ options: { shouldMinifyCSS() { return false; } } })
rollup-plugin-styles
like so: styles({ mode: 'emit', minimize: true })
I added a patch to restore space-separated pseudo class selectors while waiting on https://github.com/jakubpawlowicz/clean-css/issues/996
see also leodido/postcss-clean#39
Got it! Added my findings to that bug. Unfortunately I think for other libs like postcss-clean you'd need to completely disable tidySelectors
unless a manual patch is run like what I added.
The core issue is that the check for pseudo classes occurs on the whole selector value. This only works if the pseudo class is at the beginning of the selector (and they're often not).
:not(.complex .selector) { /* works in clean-css, first character is ":" */ }
foo:not(.complex .selector) { /* doesn't pass, spaces are removed */ }
I unfortunately don't have much time to contribute to clean-css, and the activity on that reopen is pretty fresh (a few days ago). So if you want to take that and help fix the bug I'm sure they'd appreciate it!
Thanks for publishing this awesome package.
Consider this repl:
https://repl.it/@bennypowers/minify-html-literals-css-shadow-parts-concat-bug#index.js
input:
CSS-unminified output:
Actual
CSS-minified output:
Expected
CSS-minified output:
this package should maintain the part selector
a b c
.I'm pretty sure this is an upstream issue with CleanCSS