[Bug]: Selector that never matches not removed
Author: hvenevCreated Feb 5, 2025Updated Feb 9, 2025
Labelsbug
Describe the bug
A CSS selector that only uses classes/tags/ids that occur in the content, but never matches, is not removed.
Example HTML:
<div class="div">div</div>
<span class="span">span</span>CSS:
div.span {
color: #f00;
}To Reproduce
- Copy the HTML and CSS from the example above.
- Invoke
purgecss - Observe that it does not purge the CSS
Expected Behavior
The CSS ruleset does not match anything and should therefore be removed.
Environment
purgecss version 6.0.0
Add any other context about the problem here
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Source: FullHuman/purgecss