lightningcss
lightningcss copied to clipboard
Optimize media query rulesets
It seems like there's an optimization to be had by grouping rules from the same media queries. For example, I'm working on dark mode for a project and the minified stylesheet has six instances of @media screen and (prefers-color-scheme:dark){}
. Five of those could have been removed from the output (that's 235 characters, and I'm still creating more). I can see other media queries where this should be the case as well.
Perhaps there's an edge case(s) that prevent this from being doable, but if I manually merge my six instances into one everything still works.