uncss, regex pattern for .no-'string', .is-'string'

341 Views Asked by At

I'm having some regex woes.

Using gulp-uncss

I'd like to add some classes to the ignore option.

Any class that starts with .no-

Any class that contains .is-

.no-flexbox {}
.test.is-active {}
.test .is-hidden {}


.pipe(uncss({
    html: ['tmp/public_html/*.html'],
    ignore: ['/(.is-)(\w)*', '(.no-)(\w)*']
}))

This isn't quite right

1

There are 1 best solutions below

2
On BEST ANSWER

Your regexes look incomplete. May be you should do like this

.pipe(uncss({
    html: ['tmp/public_html/*.html'],
    ignore: ['/\.no-\w+/g', '/\.\w+\s?\.is-\w+/g']
}))