Basic setup of tailwind required for react like application.
npx create-react-app myapp , cd myapp
( -D is '-g-dev' dev dependency, Postcss is to compile tailwindcss and allow autoprefixer plugin, autoprefixer is for rendering prefixes)
npm i -D tailwindcss postcss-cli autoprefixer@9.8.6 --save
`npx tailwind init -full'
const tailwindcss = require("tailwindcss");
module.exports = {
plugins: [tailwindcss("./tailwind.config.js"), require("autoprefixer")],
};
Inside folder 'scr', Create a folder named 'assets' add add two css files inside it (SRC > ASSETS >)
- main.css
- tailwind.css
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
"scripts": {
"start": "npm run watch:css && react-scripts start",
"build": "npm run build:css && react-scripts build",
"build:css": "postcss src/assets/tailwind.css -o src/assets/main.css",
"watch:css": "postcss src/assets/tailwind.css -o src/assets/main.css"
}
import './assets/main.css'
npm run