I am learning Nextjs and trying to use tailwind css with it for the first time. I notice that every change I make to the index.css file on the class selector with @apply directive of tailwind is taking 8-10s to compile and show on the browser.
Steps to reproduce :
- Run the command
npx create-next-app --example with-tailwind-css test-app
Create a button in pages/index.js and give it the classname btn-blue.
Run the server using below command
npm run dev
- Change any property inside styles/index.css file for the btn-blue selector (Ex: change bg-blue-400 to bg-red-400 or so, anything to trigger a re-compile). And observe the time it takes to reflect the changes on the localhost at browser.
Some of my observation after experimenting :
This slowness is only when making changes into the @apply style. If I comment all the tailwind code in the index.css and write my own pure css style and change it, the hot reload is instantaneous
The hot reload is instant even when changing/adding any tailwind class to the classname of the element in index.js file (Inline styling).
So the issue seems to be only when using tailwind css from an external css file.
I hope you can check and help me on this. Thanks !