Closed
Description
The recommended configuration for using PurgeCSS does not appear to work with the latest
version of PurgeCSS.
Currently it the docs recommend:
// postcss.config.js
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.vue',
'./src/**/*.jsx',
// etc.
],
// Include any special characters you're using in this regular expression
defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []
})
But it should use the extractor config recommended here in
the current docs,
it should look like:
// postcss.config.js
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./src/**/*.html',
'./src/**/*.vue',
'./src/**/*.jsx',
// etc.
],
// Include any special characters you're using in this regular expression
extractors: [
{
extractor: class PurgeExtractor {
static extract(content) {
// return array of css selectors
return content.match(/[A-Za-z0-9-_:/]+/g) || []
}
},
extensions: ["html", "vue", "jsx"]
}
]
}
Metadata
Metadata
Assignees
Labels
No labels
Activity