Enable escaped curly brace test case and preserve empty CSS rules in output#7
Merged
jogibear9988 merged 5 commits intomainfrom Mar 17, 2026
Merged
Conversation
Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
… golden file changes Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add support for valid CSS rules in parser
Enable escaped curly brace test case in escapes suite
Mar 17, 2026
jogibear9988
requested changes
Mar 17, 2026
| @@ -1,2 +1,2 @@ | |||
| /* tests compressed for easy testing */ | |||
|
|
|||
Member
There was a problem hiding this comment.
These rules here are still removed, but they are valid css!
Also the following ones....
Author
There was a problem hiding this comment.
Fixed in f6d45e8. The compiler's rule() method was stripping rules with empty declaration blocks (!decls.length → return ''). Updated it to preserve these valid CSS rules. Empty rules now output as selector {} in formatted mode and selector{} in compressed mode. All 6 empty-body rules (.\\3A \\\({}, .\31 a2b3c{}, #\#fake-id{}, #\---{}, #-a-b-c-{}, #©{}`) are now preserved in the output.
Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Co-authored-by: jogibear9988 <364896+jogibear9988@users.noreply.github.com>
Copilot
AI
changed the title
Enable escaped curly brace test case in escapes suite
Enable escaped curly brace test case and preserve empty CSS rules in output
Mar 17, 2026
jogibear9988
approved these changes
Mar 17, 2026
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
#\{\}{background:lime;}rule was commented out in the escapes test with a note that the parser doesn't support it. The parser already handles this correctly viaindexOfArrayWithBracketAndQuoteSupportwhich skips backslash-escaped characters when scanning for delimiters — so this was just a stale test exclusion.Additionally, the compiler's
rule()method was stripping CSS rules with empty declaration blocks (e.g..\3A \({},##fake-id{},#-a-b-c-{}`). These are valid CSS rules per the spec and should be preserved in the output.#\{\}{background:lime;}intest/cases/escapes/input.cssrule()insrc/stringify/compiler.tsto preserve rules with empty declaration blocks instead of dropping them (outputsselector {}in formatted mode,selector{}in compressed mode)ast.json,output.css,compressed.css) to include both the escaped curly brace rule and the previously-dropped empty-body rules✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.