提交 893f3c79 编写于 作者: V Vben

refactor(css): refactored windicss to tailwindcss

上级 e8d6f885
......@@ -122,11 +122,13 @@
"vben",
"windi",
"browserslist",
"tailwindcss",
"esnext",
"antv",
"tinymce",
"qrcode",
"sider",
"pinia"
"pinia",
"sider"
]
}
## Wip
## 2.5.0(2021-06-20)
## (破坏性更新) Breaking changes
- 将项目`windicss`改为`tailwindcss`,解决内存溢出问题
- 目前项目不兼容地方有
- `!xl:m-4` 之类的写法需要改为`xl:!m-4`,注意只有`!`这个不兼容,没用到则不用改
- `windicss`自身新增的特性需要调整,比如`Attribute`模式不兼容
### ✨ Refactor
......
......@@ -5,7 +5,6 @@ import vueJsx from '@vitejs/plugin-vue-jsx';
import legacy from '@vitejs/plugin-legacy';
import purgeIcons from 'vite-plugin-purge-icons';
import windiCSS from 'vite-plugin-windicss';
import { configHtmlPlugin } from './html';
import { configPwaConfig } from './pwa';
......@@ -46,9 +45,6 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// vite-plugin-svg-icons
vitePlugins.push(configSvgIconsPlugin(isBuild));
// vite-plugin-windicss
vitePlugins.push(windiCSS());
// vite-plugin-mock
VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild));
......
......@@ -17,7 +17,6 @@ export default {
],
transform: {
'^.+\\.tsx?$': 'ts-jest',
'^.+\\.(vue)$': 'vue-jest',
},
transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
// A map from regular expressions to module names that allow to stub out resources with a single module
......
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
};
此差异已折叠。
import '/@/design/index.less';
import '/@/design/tailwind.css';
// Register windi
import 'virtual:windi.css';
// Register icon sprite
import 'virtual:svg-icons-register';
......
......@@ -27,6 +27,7 @@ export interface Emitter {
emit<T = any>(type: EventType, event?: T): void;
emit(type: '*', event?: any): void;
clear(): void;
}
/**
......@@ -88,5 +89,12 @@ export default function mitt(all?: EventHandlerMap): Emitter {
handler(type, evt);
});
},
/**
* Clear all
*/
clear() {
this.all.clear();
},
};
}
......@@ -5,8 +5,8 @@
size="small"
:loading="$attrs.loading"
:title="item.title"
class="md:w-1/4 w-full !md:mt-0 !mt-4"
:class="[index + 1 < 4 && '!md:mr-4']"
class="md:w-1/4 w-full md:!mt-0 !mt-4"
:class="[index + 1 < 4 && 'md:!mr-4']"
:canExpan="false"
>
<template #extra>
......
......@@ -6,7 +6,7 @@
<div class="md:flex enter-y">
<VisitRadar class="md:w-1/3 w-full" :loading="loading" />
<VisitSource class="md:w-1/3 !md:mx-4 !md:my-0 !my-4 w-full" :loading="loading" />
<VisitSource class="md:w-1/3 md:!mx-4 md:!my-0 !my-4 w-full" :loading="loading" />
<SalesProductPie class="md:w-1/3 w-full" :loading="loading" />
</div>
</div>
......
......@@ -5,7 +5,7 @@
</template>
<template v-for="item in items" :key="item">
<CardGrid class="!md:w-1/3 !w-full">
<CardGrid class="md:!w-1/3 !w-full">
<span class="flex">
<Icon :icon="item.icon" :color="item.color" size="30" />
<span class="text-lg ml-4">{{ item.title }}</span>
......
......@@ -10,7 +10,11 @@
<QuickNav :loading="loading" class="enter-y" />
<Card class="!my-4 enter-y" :loading="loading">
<img class="xl:h-50 h-30 mx-auto" src="../../../assets/svg/illustration.svg" />
<img
style="height: 216px"
class="h-20 mx-auto"
src="../../../assets/svg/illustration.svg"
/>
</Card>
<SaleRadar :loading="loading" class="enter-y" />
......
......@@ -53,7 +53,7 @@
{{ t('sys.login.mobileSignInFormTitle') }}
</Button>
</ACol>
<ACol :md="8" :xs="24" class="!my-2 !md:my-0 xs:mx-0 md:mx-2">
<ACol :md="8" :xs="24" class="!my-2 md:!my-0 xs:mx-0 md:mx-2">
<Button block @click="setLoginState(LoginStateEnum.QR_CODE)">
{{ t('sys.login.qrSignInFormTitle') }}
</Button>
......
......@@ -18,7 +18,18 @@ module.exports = {
'at-rule-no-unknown': [
true,
{
ignoreAtRules: ['function', 'if', 'each', 'include', 'mixin'],
ignoreAtRules: [
'tailwind',
'apply',
'variants',
'responsive',
'screen',
'function',
'if',
'each',
'include',
'mixin',
],
},
],
'no-empty-source': null,
......
import lineClamp from 'windicss/plugin/line-clamp';
import colors from 'windicss/colors';
const colors = require('tailwindcss/colors');
import { defineConfig } from 'vite-plugin-windicss';
import { primaryColor } from './build/config/themeConfig';
export default defineConfig({
darkMode: 'class',
plugins: [lineClamp, createEnterPlugin()],
module.exports = {
mode: 'jit',
// darkMode: 'class',
plugins: [createEnterPlugin()],
purge: {
enabled: false,
content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
},
theme: {
extend: {
colors: {
...colors,
primary: primaryColor,
zIndex: {
'-1': '-1',
},
screens: {
sm: '576px',
md: '768px',
lg: '992px',
xl: '1200px',
'2xl': '1600px',
},
colors: {
...colors,
primary: {
DEFAULT: '#0960bd',
// dark: primaryColorDark,
},
},
screens: {
sm: '576px',
md: '768px',
lg: '992px',
xl: '1200px',
'2xl': '1600px',
},
},
});
};
/**
* Used for animation when the element is displayed
* @param maxOutput The larger the maxOutput output, the larger the generated css volume
*/
function createEnterPlugin(maxOutput = 10) {
const createCss = (index: number, d = 'x') => {
function createEnterPlugin(maxOutput = 6) {
const createCss = (index, d = 'x') => {
const upd = d.toUpperCase();
return {
[`*> .enter-${d}:nth-child(${index})`]: {
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册