Tailwind vite

In this article let’s discuss about Tailwind vite. Let’s go through the following methods without any delay.

Method 1:

npm install -D tailwindcss@latest postcss@latest autoprefixer@latest

npx tailwindcss init -p

# add ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'] to purge in tailwind.config.js

echo -e "@tailwind base; \n@tailwind components; \n@tailwind utilities;" >> src/index.css

# add index.css file in src/main.js
# import './index.css'

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

npm i -D tailwindcss@latest postcss@latest autoprefixer@latest

npx tailwindcss init -p

# inside tailwind.config.js 
mode: "jit", 
purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}']

# creates src/index.css and then import it into src/main.js
echo -e "@tailwind base; \n@tailwind components; \n@tailwind utilities;" >> src/index.css

# src/main.js
import './index.css'

Hope the above solution works.

Realted Posts : Perticuler version install npm