Vue + Tailwindcss config

Vue + Tailwindcss

1. Install Tailwind via npm

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

2. Create your configuration files

npx tailwindcss init -p

3. Configure Tailwind to remove unused styles in production

// tailwind.config.js
module.exports = {
purge: ['./index.html', './src/**/*.{vue,js,ts,jsx,tsx}'],
darkMode: false, // or 'media' or 'class'
theme: {
extend: {},
},
variants: {
extend: {},
},
plugins: [],
}

4. Include Tailwind in your CSS

/* ./src/index.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

5. Import your CSS in main.js

// src/main.js
import { createApp } from 'vue'
import App from './App.vue'
import './index.css'

createApp(App).mount('#app')

Guillaume Duhan

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Guillaume Duhan

Guillaume Duhan

Co-founder, Freelance & Content Creator