how add tailwind css to react code example

Example 1: how to properly install tailwind css in react

@import "tailwindcss/base";

@import "tailwindcss/components";

@import "tailwindcss/utilities";

Example 2: how to properly install tailwind css in react

"scripts": {
  "start": "npm run watch:css && react-scripts start",
  "build": "npm run watch:css && react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject",
  "watch:css": "postcss src/assets/tailwind.css -o src/assets/main.css"
}

Example 3: how to properly install tailwind css in react

touch postcss.config.js

Example 4: how to properly install tailwind css in react

npx create-react-app react-tailwindcss && cd react-tailwindcss

Example 5: working with tailwind css on your react build

npm install tailwindcss postcss-cli [email protected] -D

Tags:

Html Example