On other non-nuxt webpack projects we've used Regular Expressions for our Purge, egin a postcss.config.js file:
purgecss({
...
whitelistPatterns: [
/lazyloaded/,
/lazyload/,
...
Which does work. It's possible I'm doing something wrong, but if I try a regex on nuxt-tailwincss
Then...
purgeCSS: {
whitelist: [
// Doesn't work:
/icon/,
// Does work:
'icon',
],
},
Regex matching would be useful. Part of the reason you have whitelist in Purge will be for some programmatically generated classes, possibly looping through config, where you just want to whitelist to a pattern rather than explicit class names.
Thanks!
Hi @nathanedwards
Actually you have to use whitelistPatterns or whitelistPatternsChildren to use regular expressions, see more on https://www.purgecss.com/whitelisting#patterns
Most helpful comment
Hi @nathanedwards
Actually you have to use
whitelistPatternsorwhitelistPatternsChildrento use regular expressions, see more on https://www.purgecss.com/whitelisting#patterns