Based on the gist made by @frnwtr, purgecss-with-wordpress
is a set of templates for
Wordpress CMS.
You need to install PurgeCSS first.
Install purgecss-with-wordpress
:
npm i --save-dev purgecss-with-wordpress
import PurgeCSS from 'purgecss'
import purgecssWordpress from 'purgecss-with-wordpress'
const purgeCSSResults = await new PurgeCSS().purge({
content: ['**/*.html'],
css: ['**/*.css'],
safelist: purgecssWordpress.safelist,
safelistPatterns: purgecssWordpress.safelistPatterns
})
If you have additional classes you want to include in either of the safelist
or safelistPatterns
, you can include them using the spread operator:
safelist: [
...purgecssWordpress.safelist,
'red',
'blue',
],
safelistPatterns: [
...purgecssWordpress.safelistPatterns,
/^red/,
/blue$/,
]
Purgecss-with-wordpress use SemVer for versioning.
Purgecss-with-wordpress is based on the gist made by @frnwtr
This project is licensed under the MIT License - see the LICENSE file for details.