lightningcss icon indicating copy to clipboard operation
lightningcss copied to clipboard

Optimize media query rulesets

Open jfbrennan opened this issue 1 year ago • 3 comments

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.

jfbrennan avatar Dec 31 '22 04:12 jfbrennan