Purgecss: Template literals (Backticks) with Tailwinds extractor

Created on 25 Apr 2018  Â·  4Comments  Â·  Source: FullHuman/purgecss

purgecss:purgecss: 0.21.0

Hi,
This is probably really simple but I'm not a regex expert and backticks are giving me the headache.

The issue I found happens when the css class is next to a backtick or preceding one with no space in between , examples: /bg-yellow-dark or bg-yellow-dark or bg-yellow-dark
If this happens the class will be removed from the output.

if there are spaces inbetween then it will work as expeced i.e bg-yellow-dark

the regex that the extractor uses is this: /[A-z0-9-:\/]+/g
I'm guessing it is incomplete?
what to do?

Most helpful comment

hey this has a easy fix, just use this in your extractor instead: /[A-Za-z0-9_-:/]+/g
EDIT: fix: [A-Za-z0-9-_:/]+

All 4 comments

hey this has a easy fix, just use this in your extractor instead: /[A-Za-z0-9_-:/]+/g
EDIT: fix: [A-Za-z0-9-_:/]+

wow, thanks a lot I think that worked.

/[A-Za-z0-9_-:/]+/g gave me an error but I removed the _ as /[A-Za-z0-9-:/]+/g
and It worked

no problem, just be careful, without the _ classes with an underscore wont work, I mixed up the order of the _ and - this one will work: [A-Za-z0-9-_:/]+

thanks so muuch!

no problem, just be careful, without the _ classes with an underscore
wont work, I mixed up the order of the _ and - this one will work:
[A-Za-z0-9-_:/]+

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/FullHuman/purgecss/issues/83#issuecomment-384307750,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AKH53_lWqPrXNcSb-4qfArxryTM3QxbJks5tsIiBgaJpZM4TjbVl
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TomS- picture TomS-  Â·  3Comments

Akumzy picture Akumzy  Â·  5Comments

Pab89 picture Pab89  Â·  8Comments

knowler picture knowler  Â·  3Comments

ctf0 picture ctf0  Â·  4Comments