install tailwind css react code example

Example 1: commmand for installing tailwind to react

npm install tailwindcss

Example 2: how to properly install tailwind css in react

@import "tailwindcss/base";

@import "tailwindcss/components";

@import "tailwindcss/utilities";

Example 3: 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 4: how to properly install tailwind css in react

npm install tailwindcss postcss-cli autoprefixer@9.8.6 -D

Example 5: how to properly install tailwind css in react

const tailwindcss = require('tailwindcss');
module.exports = {
    plugins: [
        tailwindcss('./tailwind.js'),
        require('autoprefixer')
    ],
};

Example 6: how to properly install tailwind css in react

touch postcss.config.js

Tags:

Css Example