tailwindlabs / tailwindcss.com

The Tailwind CSS documentation website.
https://tailwindcss.com
3.29k stars 1.75k forks source link

Install Tailwind CSS with Vite Using React missing vite config #1874

Closed lydamian closed 1 month ago

lydamian commented 1 month ago

Missing documentation: Vite config needs these fields to work properly

  css: {
    postcss: {
      plugins: [tailwindcss()],
    },
  },

Steps to reproduce Follow the steps in this link here https://tailwindcss.com/docs/guides/vite Snapshot here for history

Screenshot 2024-09-12 at 4 07 20 PM

See relevant discussion here https://stackoverflow.com/a/77557221

adamwathan commented 1 month ago

Hey! This is unnecessary if you use npx tailwindcss init -p (like we do in the guide) which creates a postcss.config.js file with Tailwind preconfigured. Vite will read that file, the config doesn't need to be in the Vite config file for it to work 👍