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

[astro-purgecss] integration removes rules with top level :where() #676

Closed
minimaldesign opened this issue Oct 4, 2024 · 3 comments · Fixed by #765
Closed

[astro-purgecss] integration removes rules with top level :where() #676

minimaldesign opened this issue Oct 4, 2024 · 3 comments · Fixed by #765
Assignees
Labels
astro-purgecss Issues related to astro-purgecss package dependencies Pull requests that update a dependency file

Comments

@minimaldesign
Copy link

minimaldesign commented Oct 4, 2024

Describe the bug
Purgecss purges :where() top level rules from the astro build.

To Reproduce
Steps to reproduce the behavior:

Write this in your css:

:where(h1, h2, h3) {
  border: 1px solid red;
}

Then npm run build in your Astro project. Inspect the bundled CSS file and the rule will be gone.

One potentially helpful detail, if your :where() is not at the top level, then it won't be purged, so something like this for instance will work as expected:

body :where(h1, h2, h3) {
  border: 1px solid red;
}
@minimaldesign minimaldesign added the bug Something isn't working label Oct 4, 2024
@minimaldesign
Copy link
Author

Looks like a purgecss issue: FullHuman/purgecss#1282

@mhdcodes
Copy link
Member

mhdcodes commented Oct 6, 2024

Thanks for reporting on this issue. I think this is a purgecss issue, and since this plugin is a wrapper around purgecss will wait to be fixed.

@mhdcodes mhdcodes added the astro-purgecss Issues related to astro-purgecss package label Oct 6, 2024
@mhdcodes
Copy link
Member

mhdcodes commented Oct 9, 2024

You can circumvent this by adding the * or global selector before it and it will be purged correctly. The only issue with this is that it may decrease performance

FullHuman/purgecss#1282 (comment)

@mhdcodes mhdcodes changed the title Astro purgecss integration removes rules with top level :where() [astro-purgecss] integration removes rules with top level :where() Nov 2, 2024
@mhdcodes mhdcodes added dependencies Pull requests that update a dependency file and removed bug Something isn't working labels Nov 7, 2024
@mhdcodes mhdcodes linked a pull request Nov 21, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astro-purgecss Issues related to astro-purgecss package dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants