An open API service indexing awesome lists of open source software.

https://github.com/FullHuman/purgecss-with-wordpress

Purgecss with wordpress
https://github.com/FullHuman/purgecss-with-wordpress

Last synced: about 1 year ago
JSON representation

Purgecss with wordpress

Awesome Lists containing this project

README

          

# Purgecss with Wordpress

Based on the [gist](https://gist.github.com/frnwtr/5647673bb15ca8893642469d3b400cba) made by @frnwtr, `purgecss-with-wordpress` is a set of templates for
Wordpress CMS.

## Getting Started

#### Installation

You need to install [purgecss](https://github.com/FullHuman/purgecss) first.

Install `purgecss-with-wordpress`:
```sh
npm i --save-dev purgecss-with-wordpress
```

## Usage

```js

import Purgecss from 'purgecss'
import purgecssWordpress from 'purgecss-with-wordpress'

const purgeCss = new Purgecss({
content: ['**/*.html'],
css: ['**/*.css'],
whitelist: purgecssWordpress.whitelist,
whitelistPatterns: purgecssWordpress.whitelistPatterns
})
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:

```js
whitelist: [
...purgecssWordpress.whitelist,
'red',
'blue',
],
whitelistPatterns: [
...purgecssWordpress.whitelistPatterns,
/^red/,
/blue$/,
]
```

## Versioning

Purgecss-with-wordpress use [SemVer](http://semver.org/) for versioning.

## Acknowledgment

Purgecss-with-wordpress is based on the [gist](https://gist.github.com/frnwtr/5647673bb15ca8893642469d3b400cba) made by @frnwtr

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details.