Tailwindcss-module: PurgeCSS Whitelist doesn't seem to work with regex

Created on 31 Oct 2019  路  1Comment  路  Source: nuxt-community/tailwindcss-module

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!

question

Most helpful comment

Hi @nathanedwards

Actually you have to use whitelistPatterns or whitelistPatternsChildren to use regular expressions, see more on https://www.purgecss.com/whitelisting#patterns

>All comments

Hi @nathanedwards

Actually you have to use whitelistPatterns or whitelistPatternsChildren to use regular expressions, see more on https://www.purgecss.com/whitelisting#patterns

Was this page helpful?
0 / 5 - 0 ratings

Related issues

michaelpumo picture michaelpumo  路  3Comments

foxted picture foxted  路  8Comments

toxin20 picture toxin20  路  4Comments

acidjazz picture acidjazz  路  3Comments

miketromba picture miketromba  路  4Comments