I'm trying to use safelist patterns (formerly whitelist patterns) with Tailwind CSS V3.1.6 and have the following. It's not working, but essentially I'm trying to safelist all values beginning with bg-, text- and border-
safelist: [
// Retain all classes starting with...,
{
pattern: /bg-/,
pattern: /text-/,
pattern: /border-/,
},
],
You can safelist multiple entrances within an array of objects like
safelist: [
{pattern: /bg-./},
{pattern: /text-./},
{pattern: /border-./},
]
but in your case it would be shorter to use pipe sign "|"
safelist: [
{pattern: /(bg|text|border)-./}
]
More about safelisting with regular expressions can be found here
Or if you want with any pattern just one liner
pattern: /([a-zA-Z]+)-./,
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With