Closed simplenotezy closed 4 years ago
Try redeclaring extractors
with the newer documented pattern.
Note that it has to be a function in order to override the default.
I.E.
purgeCSS: {
mode: 'postcss',
/* Whatever other options */
extractors: () => [
{
extractor(content) {
return content.match(/[\w-.:/]+(?<!:)/g) || []
},
extensions: ['html', 'vue', 'js'],
},
],
},
As for why: the current release on npm is 0.2.1
.
It's still using the older pattern:
https://github.com/Developmint/nuxt-purgecss/blob/v0.2.1/lib/module.js#L31-L40
extractors: [
{
extractor: class {
static extract(content) {
return content.match(/[A-z0-9-:\\/]+/g) || []
}
},
extensions: ['html', 'vue', 'js']
}
]
That's not enough info to help. Without your config and the source code, it's not really possible.
Keep in mind that you can always whitelist classes. Also, ensure that you don't do sth like text-${color}
which PurgeCSS can't pick up.
I find the module to be working in most cases in my application, with no configuration at all.
However, I have noticed that on some page, my component is missing styling. I am not sure what causes this, but I know that I am nesting layouts (as described in this short article: https://constantsolutions.dk/2020/02/nested-layouts-in-nuxt-vue-js/
Perhaps this is the cause for the missing styling?
I am not sure where to start by debugging this, but I see that when disabling the module, it works.