-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[css-minifier]Merge the same rules #2552
Comments
Yeah I took a look at their benchmark when Lightning CSS was posted. It turns out that esbuild does this because merging rules outside of a very specific set of cases can break things for browsers that consider one rule valid but the other rule invalid. For context, these restrictions on esbuild's rule merging were added to fix #1776. This issue is an edge case where it should be possible to merge these because one rule is a subset of the other rule and only additionally uses |
Yes, Lightning CSS has access to Caniuse.com and MDN data. Another idea for selectors that are not recognized by browsers is to make the See: Forgiving Selector Parsing Input (158 Bytes).form-input:-moz-placeholder-shown {
color: black;
}
.form-input:-ms-input-placeholder {
color: black;
}
.form-input:placeholder-shown {
color: black;
} Output (133 Bytes).form-input:-ms-input-placeholder {
color: black;
}
.form-input:is(:-moz-placeholder-shown, :placeholder-shown) {
color: black;
} |
Yes, lightningcss uses compatibility data for this. Logic here: https://github.com/parcel-bundler/lightningcss/blob/d03093aceb6bbacd92283f85dd790fd274939483/src/selector.rs#L1324 |
Another example (using esbuild 0.19.4) body { font-size:16px; } Input file2.css body { color: red; } Input entry.css
Output body{font-size:16px}body{color:red} |
Currently cssnano, lightningcss are all supported.
Input
Output
Expected
The text was updated successfully, but these errors were encountered: