Purgecss with Wordpress
Based on the gist made by @frnwtr, purgecss-with-wordpress
is a set of templates for
Wordpress CMS.
Getting Started
Installation
You need to install purgecss first.
Install wenprise-purgecss-whitelist
:
npm i --save-dev wenprise-purgecss-whitelist
Usage
import Purgecss from 'purgecss'
import purgecssWhiteList from 'wenprise-purgecss-whitelist'
const purgeCss = new Purgecss({
content: ['**/*.html'],
css: ['**/*.css'],
whitelist: purgecssWhiteList.whitelist.concat([
'ln-letters',
'letterCountShow',
]),
whitelistPatterns: purgecssWhiteList.whitelistPatterns.concat([
/ln-*/,
/listNav*/,
])
})
const result = purgecss.purge()
If you have additional classes you want to include in either of the whitelist
or whitelistPatterns
, you can include them using the spread operator:
whitelist: [
...purgecssWhiteList.whitelist,
'red',
'blue',
],
whitelistPatterns: [
...purgecssWhiteList.whitelistPatterns,
/^red/,
/blue$/,
]
Versioning
Purgecss-with-wordpress use SemVer for versioning.
Acknowledgment
Purgecss-with-wordpress is based on the gist made by @frnwtr
License
This project is licensed under the MIT License - see the LICENSE file for details.