赞
踩
npm i -D tailwindcss postcss autoprefixer
命令 npx tailwindcss init
// tailwind.config.js
module.exports = {
content: ['index.html', './src/**/*.{html,js,ts,jsx,tsx,vue}'],
theme: {
extend: {}
},
plugins: []
}
// postcss.config.js
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
}
例如 assets/style/tailwind.css
·
/*assets/style/tailwind.css*/
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
// main.ts
import '@/assets/style/tailwind.css'
// tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['index.html', './src/**/*.{html,js,ts,jsx,tsx,vue}'],
theme: {
extend: {}
},
plugins: [],
corePlugins: {
preflight: false // 关闭默认样式
}
}
创建preflight.css文件,将下面链接里的样式复制到preflight.css中并注释 184行button冲突样式
https://unpkg.com/browse/tailwindcss@3.0.23/src/css/preflight.css
将preflight.css引入至tailwind.css中
/*assets/style/tailwind.css*/
@import 'tailwindcss/base';
@import './preflight.css';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
Tailwind CSS IntelliSense
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。