Repository navigation
Conversation
…inifying
The minifier removed whitespace on both sides of ":", so in a nested
selector the space that means "descendant" was lost:
& :first-child { margin: 0 } -> &:first-child{margin:0}
.a :is(h1, h2) { color: red } -> .a:is(h1,h2){color:red}
That rule then matches the element itself instead of its descendants.
Only the whitespace after ":" is removed now.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The CSS minifier removes whitespace on both sides of
:. In a declaration that is fine, but in a selector the whitespace before a pseudo-class is the descendant combinator. Removing it changes which element the rule matches:With this change the minifier removes only the whitespace after
:. A single space before:is kept, and longer runs still collapse to one space as before. The minified output for the usualcolor: redand(min-width: 600px)does not change. Only the rarecolor : redstyle now keeps one space (color :red), which is still valid CSS.The new
preserve descendant combinator before pseudo-classcase insrc/helper/css/index.test.tsxfails onmainwith.css-123{&:first-child{margin:0}&:hover:is(h1,h2){color:red}}and passes with this change.vp test --project mainpasses (123 files), andtsc -p tsconfig.spec.jsonandvp checkare clean.The author should do the following, if applicable
pnpm run check:fixto format and lint the code🤖 Generated with Claude Code