Repository navigation
[@lit-labs/rollup-plugin-minify-html-literals] feat: enable minimizing modern css features like nesting, container queries - #5208
Conversation
- Updated README to reflect the use of html-minifier-next and lightningcss. - Removed clean-css dependency and related code. - Introduced new options for lightningcss in the minification strategy. - Enhanced minification strategy to support modern CSS features like nesting and container queries. - Updated tests to verify CSS minification behavior with lightningcss.
🦋 Changeset detectedLatest commit: 6635241 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Warning point, LightningCSS is not perfect with modern CSS E.g. |
good callout and warning. Definitely something to be aware of. I may look into adding some contributions over into their repo and see if I can advance |
…edo-class - fix inaccurate test minify result to be correct
…up-plugin-minify-html-literals.spec.ts Co-authored-by: Chad Adams <[email protected]>
|
It should close #5207 instead. Hope the blocking issues will be resolved soon so I can enable the plugin back. |
justinfagnani
left a comment
There was a problem hiding this comment.
Thanks @bencbradshaw ! Sorry for the delay in reviewing.
…s features like nesting, container queries (lit#5208) Replace clean-css with lightningcss for CSS minification - Updated README to reflect the use of html-minifier-next and lightningcss. - Removed clean-css dependency and related code. - Introduced new options for lightningcss in the minification strategy. - Enhanced minification strategy to support modern CSS features like nesting and container queries. - Updated tests to verify CSS minification behavior with lightningcss.
These changes modernize the plugin's CSS minification, improve output quality and compatibility, and provide robust support for modern CSS features.
Fixes #5205
Alternative To PR 5205
Changes
Replaced clean-css with LightningCSS for CSS minification
Fixes longstanding issues:
<style>tags now work as expectedWhy LightningCSS?
After evaluating several approaches:
Option C emerged as the clear choice. LightningCSS provides everything needed out of the box. While dart-sass was considered, it strips nesting rules during compilation, effectively removing support for this modern feature. LightningCSS, by contrast, preserves native CSS nesting through the minification process.
color: whiteis transformed tocolor: #fff. These transforms can be controlled by passing the lightningcss options and with their visitor api