Purgecss
![Codacy Badge](https://api.codacy.com/project/badge/Coverage/2f2f3fb0a5c541beab2018483e62a828)
Getting Started
Installation
npm i --save-dev purgecss
Documentation
Usage
import Purgecss from "purgecss"
import purgeHtml from "purgecss-from-html"
const purgeCss = new Purgecss({
content: ["**/*.html"],
css: ["**/*.css"],
extractors: [
{
extractor: purgeHtml,
extensions: ["html"]
}
]
})
const result = purgecss.purge()
Build Plugin
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Versioning
We use SemVer for versioning.
License
This project is licensed under the MIT License - see the LICENSE file for details
Troubleshooting
The extractors needs to be defined from the more specific to the less specific. Meaning that you need to define js
extractor after ejs
. So the js
extractor will not be selected for ejs files.
You can specified extensions like .es.js
.
Some unused css are not removed
If you are using the default or legacy extractor, look here.
Head over the repository of the extractor and open an issue.
Be as precise as possible when describing the issue, provide the
css file and content file if possible.