We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
This is pretty simple to reproduce with version 3.0.0.
Create a test.js file:
var a = "class1";
And a test.css file:
.class1 { color: blue; } .class2 { color:red; } .class3 { color: green; }
Then run purgecss --content test.js --css test.css --safelist class2 (as documented):
purgecss --content test.js --css test.css --safelist class2
$ npx purgecss --content test.js --css test.css --safelist class2 [14:28:56] [{"css":".class1 {\n color: blue;\n}\n\n.class2 {\n color:red;\n}\n\n.class3 {\n color: green;\n}\n","file":"test.css"}] (node:15305) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined at U.shouldKeepSelector (/Users/dbruhn/repos/temp/node_modules/purgecss/lib/purgecss.js:1:9032)
The output is created despite the error, but all classes are preserved. (class3 should have been purged.)
class3
Purging works fine without the whitelist:
$ npx purgecss --content test.js --css test.css [14:28:59] [{"css":".class1 {\n color: blue;\n}\n","file":"test.css"}]
The code is throwing because this.options.safelist.greedy is undefined:
this.options.safelist.greedy
purgecss/packages/purgecss/src/index.ts
Line 711 in beb4a59
The text was updated successfully, but these errors were encountered:
43dbe3c
Successfully merging a pull request may close this issue.
This is pretty simple to reproduce with version 3.0.0.
Create a test.js file:
And a test.css file:
Then run
purgecss --content test.js --css test.css --safelist class2
(as documented):The output is created despite the error, but all classes are preserved. (
class3
should have been purged.)Purging works fine without the whitelist:
The code is throwing because
this.options.safelist.greedy
is undefined:purgecss/packages/purgecss/src/index.ts
Line 711 in beb4a59
The text was updated successfully, but these errors were encountered: