PurgeCSS ignore all width and responsive width classes in TailwindCSS

Viewed 1694

I want to ignore all classes started with w- and all breakpoint width classes like lg:w- in Tailwind Utility classes.

This is what I did in my tailwind.config.js file:

purge: {
    options: {
      whitelistPatterns: [/^w-/]
    }
  },

But it seems not ignoring w- classes. How can I do this?

1 Answers

I don't think your regex is working as expected in your whitelistPatterns if you take a look at https://regexr.com/5kifo. It will match all w- classes thanks to the addition of + at the end.

The regex for those who don't want to click on the link: /w-+/g

Related