查看官方文档,不要去看过时的文章!
使用官网推荐的第一个安装方法 Installation - Tailwind CSS
vue版本:2.6.10
1. 安装tailwind的包
npm install -D tailwindcss
npx tailwindcss init
2. tailwind.config.js 文件中的content是你需要使用tailwind的文件路径
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/views/**/*.vue"],
theme: {
extend: {
colors: {
grey: {
default: '#999999'
},
yellow: {
default: '#FF9A00',
},
},
fontSize: {
'small': ['12px'],
}
},
},
plugins: [],
}
3. 新建tailwind.css文件
@tailwind base;
@tailwind components;
@tailwind