Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,39 @@ export default {
}
```

### Use custom extractors
Only one extractor can be applied to each file extention.
If you want to apply a custom extractor to the extensions that the default extractor already covers, you have to override the default extractor. This is only possible with the functional notation.

```js
//nuxt.config.js
export default {
modules: [
'nuxt-purgecss',
],

purgeCSS: {
extractors: () => [
{
extractor: class {
static extract(content) {
return content.match(/[A-z0-9-:\\/]+/g)
}
},
extensions: ['html', 'vue', 'js']
},
{
extractor: class {
static extract(content) {
return content.match(/[A-z0-9-\\/]+/g)
}
},
extensions: ['vue'] // This will not work, because the above extractor is applied to 'vue' already.
}
]
}
}
```

## Development

Expand Down