You point PurgeCSS at your content files (HTML, JS, templates) and your CSS files. It builds a list of selectors used in the content, then compares that list against all selectors in your CSS. Any selector not found in the content gets stripped from the final output. You can configure the tool via a configuration file, command-line interface, or programmatic API.
PurgeCSS is best suited for developers already using a build tool such as Webpack, Gulp, or PostCSS who want a configurable, automated way to remove dead CSS. It supports safelisting and custom extractors for edge cases, though you must verify that dynamically generated class names in your JavaScript are caught by your extractors or safelisted explicitly.
Removes CSS selectors that do not match any selector found in your project's content files.
Supports custom extractors to detect CSS class usage in non-standard file types or template syntaxes.
Lets you specify selectors that should never be removed regardless of content analysis.
Process CSS through a JavaScript API for integration into custom build scripts.
Runs from the command line without requiring a configuration file or build setup.
Works with Vue.js, Nuxt.js, React.js, Next.js, Razzle, WordPress, and Hugo through dedicated guides.
Pricing extracted from the product website and may change. Check the source for current details.
PurgeCSSThis | ||||
|---|---|---|---|---|
| Starting price | Free | Free | Free | Free |
| Pricing model | Free | Free | Free | Free |
| Platforms | Web | — | Web | Web |
| Top features |
|
|
|
|
| Rating | — | — | — | — |