You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It removes psedo-classes without a selector before it.
/* This will be removed and purged incorrectly */
:hover { }
:not(:hover) { }
:where() {}
:where(:hover) {}
etc..
/* This will not be removed and purged incorrectly */
*:hover { }
.class:hover { }
#id:hover { }
[attribute]:hover { }
::after { }
::before { }
and etc.
It doesn't affect pseudo-elements like ::after but affects pseudo-classes. There are some exceptions which are :root but I haven't found more exceptions beyond that
geomydas
changed the title
[Bug]: Pseudo-elements and pseudo-classes incorrectly purged when there is no selector before it
[Bug]: Pseudo-classes incorrectly purged when there is no selector before it
Oct 4, 2024
I use a CSS library called Open Props and it uses :where(html) to contain the variables to avoid any specificty conflict and I noticed that it affected other pseudo-selectors aswell
Just noticed that in the Astro integration. It is particularly problematic with things like:
:where(h1,h2,h3) {
...
}
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
geomydas
changed the title
[Bug]: Pseudo-classes incorrectly purged when there is no selector before it
[Bug]: Most pseudo-classes incorrectly purged when there is no selector before it
Oct 23, 2024
Describe the bug
It removes psedo-classes without a selector before it.
It doesn't affect pseudo-elements like
::after
but affects pseudo-classes. There are some exceptions which are:root
but I haven't found more exceptions beyond thatThe bug can be sourced from https://purgecss.com/extractors.html
To Reproduce
Already described
Expected Behavior
I was expecting them to be not removed in the CSS
Environment
OS: Linux Mint;
Package: purgecss;
Version: 6.0.0;
Add any other context about the problem here
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: