Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use tailwindcss/jit library with create-react-app?

I followed this installation step to configure tailwindcss in create-react-app. It works, but after adding tailwindcss/jit, app is not working. I think that it happens because create-react-app doesn't support PostCSS 8, but it seems that tailwindcss/jit requires PostCSS 8.

Any idea?

like image 834
endmaster0809 Avatar asked Mar 15 '21 19:03

endmaster0809


People also ask

How do you add a JIT in tailwind?

It's pretty easy to enable the JIT compiler. All you have to do is update your tailwind. config. js file by adding the mode property which should have a value of 'jit'.

Does create react app support Postcss 8?

From what I've found, create-react-app does not support PostCSS 8 yet, see: https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users.

Does create react app use Postcss?

Create React App does not support PostCSS 8 yet, so we'll install the version of PostCSS 7 that is compatible with Tailwind CSS v2.


1 Answers

jit is now included in the v2.1.0 build so you just need to upgrade. Easiest way is to just uninstall the dependencies and reinstall.

It's working in my app...but not all classes are being output so that will be something I need to figure out.

npm uninstall tailwindcss
npm install -D tailwindcss@npm:@tailwindcss/postcss7-compat @tailwindcss/postcss7-compat
like image 167
nathanjessen Avatar answered Sep 21 '22 18:09

nathanjessen