To incorporate tailwind css into your project, simply follow these steps:
Step 1 : Install Required Packages
npm install tailwindcss postcss autoprefixer
npx tailwindcss init
Step 2 : Set up postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
Step 3 : Configure tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
"./src/**/*.{js,ts,jsx,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Step 4 : Include the styles in your CSS file
/* styles/globals.css */
@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";
That's it!
For a more comprehensive guide, refer to: