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

Don’t crash when important and parent selectors are equal in @apply #12112

Merged
merged 2 commits into from Sep 29, 2023

Conversation

thecrypticace
Copy link
Contributor

Previously, when you:

  1. Have configured an important selector; AND
  2. Add a component to the components layer; AND
  3. The component's selector is the same as the important selector; AND
  4. It uses @apply

We would crash because we'd end up replacing a selector in a way that it became empty. This PR fixes this problem, we no longer crash, and now generate the expected CSS.

Before — with important: ':root' this would crash:

@tailwind components;
@layer components {
  :root {
    @apply flex;
  }
}

Now it generates the following:

:root {
  display: flex;
}

Fixes #12110

@thecrypticace thecrypticace merged commit 457d2b1 into master Sep 29, 2023
10 checks passed
@thecrypticace thecrypticace deleted the fix/important-apply-crash branch September 29, 2023 20:04
thecrypticace added a commit that referenced this pull request Oct 23, 2023
…#12112)

* Don’t crash when important and parent selectors are equal in `@apply`

* 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.

Compilation error for rule reusing important selector within a layer and using @apply
1 participant