Goto tailwind css documentation [ https://tailwindcss.com/docs/installation ]
Install tail wind css dependency via cli using the following command
npm install -D tailwindcss
(This will update tailwind css as dev dependency in package.json)
Run the following command to create tailwind css config js file
npx tailwindcss init
Configuring the templates path
Add the following in tailwind.config.js file
content: ["./public/*.{html}"],
Create a folder src, then create new file input.css
Add the below lines in input.css file
@tailwind base;
@tailwind components;
@tailwind utilities;
Command to generate style.css as output file with watch flag
npx tailwindcss -i ./src/input.css -o ./public/style.css --watch
Configuring the build script of tail wind css file in package.json
Add below line in package.json
"build": "tailwindcss -i ./src/input.css -o ./public/style.css --watch"
Use the below command to run the above script
npm run build
Linking index.html file with generated style.css file.
<link rel="stylesheet" href="style.css">