Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind JIT do not generate class with slash after it #6358

Closed
Foprta opened this issue Dec 10, 2021 · 3 comments
Closed

Tailwind JIT do not generate class with slash after it #6358

Foprta opened this issue Dec 10, 2021 · 3 comments

Comments

@Foprta
Copy link

Foprta commented Dec 10, 2021

What version of Tailwind CSS are you using?

v2.2, v3

What build tool (or framework if it abstracts the build tool) are you using?

angular: 12.2

What version of Node.js are you using?

v16.13.0

What browser are you using?

Chrome

What operating system are you using?

Windows, Linux

Reproduction URL

https://github.com/Foprta/tailwind-repr

npm ci
npm run build:lib
npm run start

Text with text-blue-500 is not blue

Describe your issue

Compiled angular library in node_modules have code:

image

Our purge paths are : ['./node_modules/our-angular-lib/**/*.js']

And it does not generate classes with a slash in the end, like highligthed tw-bg-gray-400.

If i create one more tw-bg-gray-400 right before the existing one, JIT will generate it.

tailwindcss: 2.2.19

@ortuagustin
Copy link

ortuagustin commented Dec 15, 2021

I have the same issue with tailwind 3; setup is similar to OP, a vue library that ships some shared components. Classes ending in slash are not picked by JIT engine, ie:

// somewhere in a large js built package, a vue component render function

\"class\": \"grid md:grid-cols-12\"\n    }

Class grid is picked by JIT engine; md:grid-cols-12 is not picked. Will try changing JIT regex or disable minification/whitespace handling on the library

@linoDOTzip
Copy link

Could be fixed by changing the class-candidate regex in the expandTailwindAtRules.js file

from
/([^<>"'`\s]*[^"'`\s:])/.source
to
/([^<>"'`\s]*[^"'`\s:\\])/.source

ref: 553fbaa
works fine in my testing

@thecrypticace
Copy link
Contributor

Fixed in #6590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants