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

[JIT] not working with @craco/craco #3998

Closed
createdbymahmood opened this issue Apr 7, 2021 · 4 comments
Closed

[JIT] not working with @craco/craco #3998

createdbymahmood opened this issue Apr 7, 2021 · 4 comments

Comments

@createdbymahmood
Copy link

What version of Tailwind CSS are you using?

2.1.0

What version of Node.js are you using?

12.20.0

What browser are you using?

Chrome

What operating system are you using?

Windows

Reproduction repository

https://github.com/createdbymahmood/craco-tailwindcss-problem

I'm using TailwindCSS with craco, to support "css modules apply syntax", in addition, I want to use "Just-in-time", it does not work as expected, styles are not getting compiled fine. only tailwind base styles (normalizers) are available to use now.

@devpeerapong
Copy link

I think JIT doesn't support PostCSS 7

@sveisvei
Copy link

Indeed, the provided reproduction repository does have the Postcss 7:
https://github.com/createdbymahmood/craco-tailwindcss-problem/blob/main/package-lock.json#L2029

@createdbymahmood createdbymahmood changed the title JIT not working with @craco/craco [JIT] not working with @craco/craco Apr 26, 2021
@bradlc
Copy link
Contributor

bradlc commented Apr 30, 2021

Hey @createdbymahmood, two things:

  1. You need to upgrade tailwindcss to 2.1.2 – there was a bug relating to PostCSS 7 which was fixed in Fix media queries with jit and postcss7 #4078:
npm uninstall @tailwindcss/postcss7-compat tailwindcss
npm install tailwindcss@npm:@tailwindcss/postcss7-compat
  1. You need to specify your template paths in the purge option of your tailwind.config.js file. Without this the JIT engine does not know which classes to generate. For example:
module.exports = {
  purge: ['./src/**/*.js'],
  // ...
}

I have opened a pull request on your reproduction repository and confirmed that it's now working 👍 Any other issues let us know!

@bradlc bradlc closed this as completed Apr 30, 2021
@M0hammedImran
Copy link

Hey @createdbymahmood, two things:

  1. You need to upgrade tailwindcss to 2.1.2 – there was a bug relating to PostCSS 7 which was fixed in Fix media queries with jit and postcss7 #4078:
npm uninstall @tailwindcss/postcss7-compat tailwindcss
npm install tailwindcss@npm:@tailwindcss/postcss7-compat
  1. You need to specify your template paths in the purge option of your tailwind.config.js file. Without this the JIT engine does not know which classes to generate. For example:
module.exports = {
  purge: ['./src/**/*.js'],
  // ...
}

I have opened a pull request on your reproduction repository and confirmed that it's now working 👍 Any other issues let us know!

This worked for me. I had a relatively old project and just installed tailwind and JIT is the best thing that happened to tailwind after v2.0.

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

5 participants