DEV Community

Wahid
Wahid

Posted on

3

How to fix TailwindCSS not working with Vite + React

Tailwind CSS requires two key configuration files: tailwind.config.js and postcss.config.js. If you don't run npx tailwindcss init -p, these files won't be generated, which can cause issues with Tailwind not working correctly.

  • Missing tailwind.config.js: Without this file, Tailwind can't process your files or customize the framework.
  • Missing postcss.config.js: PostCSS won't be set up, causing Tailwind's utilities to not be compiled correctly.

Solution:
Run

npx tailwindcss init -p
Enter fullscreen mode Exit fullscreen mode

to generate both files. This ensures proper configuration and PostCSS setup, allowing Tailwind to work as expected.

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay