FullHuman/purgecss

CSS attribute selectors not being removed

davidhouweling opened this issue · 3 comments

Describe the bug
As part of normalize.css, it uses attribute selectors as a means to select elements, however these get left in by purgecss.

To Reproduce

  1. Using the following HTML
<html>
  <body>
    <div class="component"></div>
  </body>
</html>
  1. With the following CSS
.component { color: black; }
button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}
  1. Passing the above HTML and CSS through the CLI
  2. The resulting CSS is as followed
.component { color: black; }
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

Expected behavior
The generated CSS should be

.component { color: black; }

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Windows 10 version 1709
  • Version of Purgecss 1.0.1

Additional context
N/A

At the moment purgecss only works with basic selectors like id, class and tag because of limitations in the extractors.

Sorry to bother, but any ETA on this one?

if anyone's interested, i made an alternative css cleanser that handles this (and many other issues) properly.

https://github.com/leeoniya/dropcss