What do I have to do differently with craco ? I have enabled mode:"jit" in tailwind.config.js . How should I write the build script for that? Here is my current build script . What should I add?
hm! it seems to work fine for me, I just created a repository and using craco instead of react-scripts, you can try and see if it works for you. github.com/ako-v/cra-tailwindcss-j...
after building, serve the build folder using npm run servebuild and open http://localhost:3000 in your browser.
probably you have not appended @latest at the end of packages. reinstall them with this exact command: npm install -D tailwindcss@latest postcss@latest postcss-cli@latest autoprefixer@latest
Thanks for adding the repo! It's working now but I for me I had to install postcss@latest and I also had to add start": "react-scripts start back into package.json file. Kudos!
install postcss-cli using npm i -D postcss-cli@latest, then run your app using npm run dev.
Sorry I forgot to include postcss-cli in installation part.
sorry for late response, I think you are on windows. just install cross-env and change the start script in package.json to this: "start": "cross-env TAILWIND_MODE=watch craco start"
We're a place where coders share, stay up-to-date and grow their careers.
What do I have to do differently with craco ? I have enabled mode:"jit" in tailwind.config.js . How should I write the build script for that? Here is my current build script . What should I add?
dev-to-uploads.s3.amazonaws.com/up...
hm! it seems to work fine for me, I just created a repository and using
cracoinstead of react-scripts, you can try and see if it works for you.github.com/ako-v/cra-tailwindcss-j...
after building, serve the build folder using
npm run servebuildand openhttp://localhost:3000in your browser.I get error:
Error: PostCSS plugin tailwindcss requires PostCSS 8.
Migration guide for end-users:
github.com/postcss/postcss/wiki/Po...
probably you have not appended
@latestat the end of packages. reinstall them with this exact command:npm install -D tailwindcss@latest postcss@latest postcss-cli@latest autoprefixer@latest
I copy/pasted everything. It would be nice if you had an example repo where we could just clone/install and ensure that it works.
Oh! Sorry, I didn't think it would be necessary. here it is:
github.com/ako-v/cra-tailwind-jit
I will also add it into the post itself.
Thanks for adding the repo! It's working now but I for me I had to install
postcss@latestand I also had to addstart": "react-scripts startback into package.json file. Kudos!I also realized the postcss package is not necessary at all, the postcss-cli is enough.
and if you use craco in package.json is better
If you want to override some configurations, yes, you have to use craco.
I followed exactly but I dont get a blue screen, just an unstyled "JIT mode is cool" Lorem... page and none of the tailwind styles work. Any ideas?
install postcss-cli using
npm i -D postcss-cli@latest, then run your app usingnpm run dev.Sorry I forgot to include postcss-cli in installation part.
it works!! thanksss live saverr
Your welcome 😃
Getting this error while running npm start
'TAILWIND_MODE' is not recognized as an internal or external command,
operable program or batch file.
sorry for late response, I think you are on windows. just install
cross-envand change the start script in package.json to this:"start": "cross-env TAILWIND_MODE=watch craco start"