0

I'm trying to use tailwindcss in my React Project developed through Vite. But it's not working. Let me explain the process step by step.

At first, I run following commands:

npm install -D tailwindcss
npx tailwindcss init

Then, added following code to my tailwind.config.js file.

/** @type {import('tailwindcss').Config} */
export default {
  content: ["./src/*.{html,js,jsx}"],
  theme: {
    extend: {},
  },
  plugins: [],
}

After that, added tailwind layers to index.css file.

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

And finally, run the following command:

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

But the issue is that the styles aren't generating at all through tailwind. Also, my package.json also shows tailwind in devDependencies:

"devDependencies": {
    "@types/react": "^18.2.43",
    "@types/react-dom": "^18.2.17",
    "@vitejs/plugin-react": "^4.2.1",
    "eslint": "^8.55.0",
    "eslint-plugin-react": "^7.33.2",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-react-refresh": "^0.4.5",
    "tailwindcss": "^3.4.1",
    "vite": "^5.0.8"
  }

Here is the link to github repo: https://github.com/muhammadfuaad/my_react_app

1 Answer 1

0

change from content: ["./src/*.{html,js,jsx}"], to content: ["./src/**/*.{html,js,jsx}"], in your tailwind.config.js file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.