PurgeCSS class
Class used to instantiate PurgeCSS and can then be used to purge CSS files.
Signature:
declare class PurgeCSS
Example
await new PurgeCSS().purge({
content: ['index.html'],
css: ['css/app.css']
})
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
options | Options | ||
removedNodes | postcss.Node[] | ||
selectorsRemoved | Set<string> | ||
variablesStructure | VariablesStructure |
Methods
Method | Modifiers | Description |
---|---|---|
extractSelectorsFromFiles(files, extractors) | Extract the selectors present in the files using a PurgeCSS extractor | |
extractSelectorsFromString(content, extractors) | Extract the selectors present in the passed string using a PurgeCSS extractor | |
getPurgedCSS(cssOptions, selectors) | Get the purged version of the css based on the files | |
purge(userOptions) | Remove unused CSS | |
removeUnusedCSSVariables() | Remove unused CSS variables | |
removeUnusedFontFaces() | Remove unused font-faces | |
removeUnusedKeyframes() | Remove unused keyframes | |
walkThroughCSS(root, selectors) | Walk through the CSS AST and remove unused CSS |