chore: add windi.config.ts

This commit is contained in:
Vben 2021-08-04 23:26:08 +08:00
parent 8e5740e715
commit 62f8468775

View File

@ -1,21 +1,18 @@
module.exports = { import colors from 'windicss/colors';
mode: 'jit', import { defineConfig } from 'vite-plugin-windicss';
import { primaryColor } from './build/config/themeConfig';
export default defineConfig({
darkMode: 'class', darkMode: 'class',
plugins: [createEnterPlugin()], plugins: [createEnterPlugin()],
purge: {
enable: process.env.NODE_ENV === 'production',
content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
},
theme: { theme: {
extend: { extend: {
zIndex: { zIndex: {
'-1': '-1', '-1': '-1',
}, },
colors: { colors: {
primary: { ...colors,
DEFAULT: '#0960bd', primary: primaryColor,
// dark: primaryColorDark,
},
}, },
screens: { screens: {
sm: '576px', sm: '576px',
@ -26,13 +23,14 @@ module.exports = {
}, },
}, },
}, },
}; });
/** /**
* Used for animation when the element is displayed * Used for animation when the element is displayed
* @param maxOutput The larger the maxOutput output, the larger the generated css volume * @param maxOutput The larger the maxOutput output, the larger the generated css volume
*/ */
function createEnterPlugin(maxOutput = 6) { function createEnterPlugin(maxOutput = 10) {
const createCss = (index, d = 'x') => { const createCss = (index: number, d = 'x') => {
const upd = d.toUpperCase(); const upd = d.toUpperCase();
return { return {
[`*> .enter-${d}:nth-child(${index})`]: { [`*> .enter-${d}:nth-child(${index})`]: {