Next.js with Tailwind Refreshes Slow

Viewed 1385

I experienced an extremely sluggish refresh time after adding Tailwind to my small Next project. I initially thought it was my device.

3 Answers

I solved it by removing the

@tailwind base;
@tailwind components;
@tailwind utilities;

from my global.css file. The disadvantage to this is that you will not be able to apply tailwind classes inline but you can still write your tailwind in your css files and use @apply.

I solved this by using Tailwind's just-in-time mode.

// tailwind.config.js

module.exports = {
 mode: 'jit',
 ...
}

This feature is currently in preview, which means it's subject to change, but it worked for me.

I solved this by removing @tailwind directives from global.css file like @GeniusHawlah.

then Tailwind CLI:

npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch

and i imported output.css to my global.css. when i edit *.jsx files, tailwindcss update output.css.

Related