#command
// add this in the hed tag and start using Tailwind css
<script src="https://cdn.tailwindcss.com"></script>- npm init --y
- npm install -D tailwindcss postcss autoprefixer
- npm i vite
- npx tailwindcss init
- add this in the package.json folder(scripts) "start": "vite"
- npm run start(to run the server)
- install Tailwind CSS IntelliSense(this is vs code exptension)
//For the production in the indusries.
- npm init -y
- npm install -D tailwindcss postcss autoprefixer
- npx tailwindcss init -p
- create a css file "input.css". add it to your html and edit it with this content:
@tailwind base; @tailwind components; @tailwind utilities;
- In your tailwind.config.js file replace content:[], with content:["*"],
- Add "start":"vite" to your scripts in package.json
- create a index.html file
- add this in the html file in the header section
now we can use tailwind css. 9. Run npm run start command to start a dev server
// command using react in CRA(create react app)
- npx create-react-app my-project
- cd my-project
- npm install -D tailwindcss
- npx tailwindcss init
- now paste this in the tailwind.config.js file
/** @type {import('tailwindcss').Config} / module.exports = { content: [ "./src/**/.{js,jsx,ts,tsx}", ], theme: { extend: {}, }, plugins: [], }
- add this in the index.css
@tailwind base; @tailwind components; @tailwind utilities;
-
npm run start(to run command)
-
write the code in the app.js or in the other component
// command using vite
- npm create vite@latest my-project -- --template react
- cd my-project
- npm install -D tailwindcss postcss autoprefixer
- npx tailwindcss init -p
- now paste this in the tailwind.config.js file
/** @type {import('tailwindcss').Config} / export default { content: [ "./index.html", "./src/**/.{js,ts,jsx,tsx}", ], theme: { extend: {}, }, plugins: [], }
- add this in the index.css
@tailwind base; @tailwind components; @tailwind utilities;
- npm run dev
- write the code in the app.js or in the other component