Print unknown at-rules in the same location#1233
Merged
Merged
Conversation
eb6e426 to
a6aa283
Compare
a6aa283 to
1fb0a2d
Compare
devongovett
approved these changes
May 17, 2026
devongovett
left a comment
Member
There was a problem hiding this comment.
I guess this makes sense. With other at rules, the at rule gets hoisted and the style rule gets placed inside it, but I guess if the at rule is unknown we can't do that or even know if it's the desired behavior so just preserving it as is makes sense.
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.
This PR is an attempt in fixing #1232 where unknown at-rules were hoisted outside of its parent instead of staying in place. This PR is not adding proper support for
@apply, but is just used as an example.I added some tests with various syntaxes as seen in https://drafts.csswg.org/css-mixins-1/#apply-rule. I also added some nesting to make sure that works as expected.
Added some tests with the following input:
Before, this would generate:
As you can see, the
.fooand.barare even gone, because at some point they won't contain any declarations anymore and are just removed.But with this PR, it will generate:
Like I mentioned before, this doesn't add proper support for
@apply, so this is just an attempt in properly printing the correct output. There is no validation related to the actual mixins that are being applied here.Fixes: #1232