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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more