Skip to content
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

Fix source maps of variant utilities that come from an @layer rule #12508

Merged
merged 5 commits into from
Dec 1, 2023

Conversation

thecrypticace
Copy link
Contributor

If you have a utility like the following:

@layer utilities {
  .foo {
    color: red;
  }
}

And your content contains foo or hover:foo then the generated CSS has correct source map information. However, in the case of a utility with a variant that generates an at-rule (e.g. lg:foo) we were incorrectly overwriting this information for all rules inside the at-rule.

Now, after this PR, these source locations are correctly preserved.

Fixes #12464

@thecrypticace thecrypticace changed the base branch from 3.3 to master December 1, 2023 15:53
@thecrypticace thecrypticace merged commit 317fba1 into master Dec 1, 2023
10 checks passed
@thecrypticace thecrypticace deleted the fix/at-rule-variant-source-maps branch December 1, 2023 16:05
thecrypticace added a commit that referenced this pull request Dec 1, 2023
…12508)

* Refactor

* Keep traversing sibling nodes

* Make sure the root node has a source location for the end

* Add source map test for at-rule variants

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Variants of @layer-provided utilities have incorrect source map locations
1 participant