PostCSS plugin for PurgeCSS
npm install @fullhuman/postcss-purgecss[PostCSS] plugin for PurgeCSS.
[PostCSS]: https://github.com/postcss/postcss
```
npm i -D @fullhuman/postcss-purgecss postcss
`js`
const purgecss = require('@fullhuman/postcss-purgecss')
postcss([
purgecss({
content: ['./src/*/.html']
})
])
See [PostCSS] docs for examples for your environment.
All of the options of purgecss are available to use with the plugins.
You will find below the main options available. For the complete list, go to the purgecss documentation website.
You can specify content that should be analyzed by Purgecss with an array of filenames or globs. The files can be HTML, Pug, Blade, etc.
$3
Type: (sourceInputFile: string) => ArrayThe function receives the current source input file. With this you may provide a specific array of globs for each input. E.g. for
an angular application only scan the components template counterpart for every component scss file:
`js
purgecss({
contentFunction: (sourceInputFileName: string) => {
if (/component\.scss$/.test(sourceInputFileName))
return [sourceInputFileName.replace(/scss$/, 'html')]
else
return ['./src/*/.html']
},
})
`$3
Type: Array