Open AdrianGonz97 opened 11 months ago
a hack is to safelist a regex like /:not.+/
a hack is to safelist a regex like
/:not.+/
As there’s the same issue (#978) for multiple pseudo-selectors, what I do is the following:
const purgeCssOptions = {
safelist: [
/:is/, // https://github.com/FullHuman/purgecss/issues/978
/:where/, // https://github.com/FullHuman/purgecss/issues/978
/:not/, // https://github.com/FullHuman/purgecss/issues/1197
],
}
PurgeCSS is clearly lacking more ways than this. When I used it to audit TailwindCSS against a html file, it totally ignored the utility classes for media query breakpoints: *8sm, md, lg, xl, 32xl**
To cater for my needs I created a thorough and concise alternative available here: https://www.npmjs.com/package/rmrf-css. I'm sure it will provide the expected output you seek. Cheers
Describe the bug
When the pseudo-class
:where
is a child of:not
and the selector inside of:where
is an "unused" selector, it is incorrectly purged.I would also assume that
:is
is also affected by this as both pseudo-classes are treated similarly.To Reproduce
Expected Behavior
The rule should not be purged.
Environment
purgecss@6.0.0-alpha.0
Add any other context about the problem here
n/a
Code of Conduct