DEV Community

Cover image for Vite vue ts tailwind template: Install TailwindCSS
Sardorbek Imomaliev
Sardorbek Imomaliev

Posted on

4 2 1

Vite vue ts tailwind template: Install TailwindCSS

Install and setup TailwindCSS

  1. Start by following official Install Tailwind CSS with Vue 3 and Vite instructions. Install tailwindcss.

    $ npm install --save-dev tailwindcss@latest postcss@latest autoprefixer@latest
    
  2. Create configuration files.

    $ npx tailwindcss init -p
    
  3. Configure tree-shaking (removal of unused styles). Update tailwind.config.js.

    -  purge: [],
    +  purge: ['./index.html', './src/**/*.{js,jsx,ts,tsx,vue}'],
    
  4. Create index.css. touch src/index.css.

  5. Update src/index.css.

    +@tailwind base;
    +@tailwind components;
    +@tailwind utilities;
    
  6. Import src/index.css in src/main.ts.

     import App from '@/App.vue'
    +import '@/index.css'
    
  7. git add -u && git add tailwind.config.js postcss.config.js src/index.css

  8. git commit -m 'install tailwindcss'

Links

Project

GitHub logo imomaliev / vue-ts-tailwind

Vite + Vue + TypeScript + TailwindCSS template

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay