mirror of
https://github.com/vbenjs/vben-admin-thin-next.git
synced 2025-02-02 18:08:40 +08:00
refactor(css): refactored windicss to tailwindcss
This commit is contained in:
parent
e8d6f8851e
commit
893f3c79e7
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -122,11 +122,13 @@
|
|||||||
"vben",
|
"vben",
|
||||||
"windi",
|
"windi",
|
||||||
"browserslist",
|
"browserslist",
|
||||||
|
"tailwindcss",
|
||||||
"esnext",
|
"esnext",
|
||||||
"antv",
|
"antv",
|
||||||
"tinymce",
|
"tinymce",
|
||||||
"qrcode",
|
"qrcode",
|
||||||
"sider",
|
"sider",
|
||||||
"pinia"
|
"pinia",
|
||||||
|
"sider"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
## Wip
|
## 2.5.0(2021-06-20)
|
||||||
|
|
||||||
|
## (破坏性更新) Breaking changes
|
||||||
|
|
||||||
|
- 将项目`windicss`改为`tailwindcss`,解决内存溢出问题
|
||||||
|
- 目前项目不兼容地方有
|
||||||
|
- `!xl:m-4` 之类的写法需要改为`xl:!m-4`,注意只有`!`这个不兼容,没用到则不用改
|
||||||
|
- `windicss`自身新增的特性需要调整,比如`Attribute`模式不兼容
|
||||||
|
|
||||||
### ✨ Refactor
|
### ✨ Refactor
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import vueJsx from '@vitejs/plugin-vue-jsx';
|
|||||||
import legacy from '@vitejs/plugin-legacy';
|
import legacy from '@vitejs/plugin-legacy';
|
||||||
|
|
||||||
import purgeIcons from 'vite-plugin-purge-icons';
|
import purgeIcons from 'vite-plugin-purge-icons';
|
||||||
import windiCSS from 'vite-plugin-windicss';
|
|
||||||
|
|
||||||
import { configHtmlPlugin } from './html';
|
import { configHtmlPlugin } from './html';
|
||||||
import { configPwaConfig } from './pwa';
|
import { configPwaConfig } from './pwa';
|
||||||
@ -46,9 +45,6 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
|
|||||||
// vite-plugin-svg-icons
|
// vite-plugin-svg-icons
|
||||||
vitePlugins.push(configSvgIconsPlugin(isBuild));
|
vitePlugins.push(configSvgIconsPlugin(isBuild));
|
||||||
|
|
||||||
// vite-plugin-windicss
|
|
||||||
vitePlugins.push(windiCSS());
|
|
||||||
|
|
||||||
// vite-plugin-mock
|
// vite-plugin-mock
|
||||||
VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild));
|
VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild));
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ export default {
|
|||||||
],
|
],
|
||||||
transform: {
|
transform: {
|
||||||
'^.+\\.tsx?$': 'ts-jest',
|
'^.+\\.tsx?$': 'ts-jest',
|
||||||
'^.+\\.(vue)$': 'vue-jest',
|
|
||||||
},
|
},
|
||||||
transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
|
transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
|
||||||
// A map from regular expressions to module names that allow to stub out resources with a single module
|
// A map from regular expressions to module names that allow to stub out resources with a single module
|
||||||
|
@ -87,9 +87,8 @@
|
|||||||
"@vitejs/plugin-vue": "^1.2.3",
|
"@vitejs/plugin-vue": "^1.2.3",
|
||||||
"@vitejs/plugin-vue-jsx": "^1.1.5",
|
"@vitejs/plugin-vue-jsx": "^1.1.5",
|
||||||
"@vue/compiler-sfc": "3.0.11",
|
"@vue/compiler-sfc": "3.0.11",
|
||||||
"@vue/test-utils": "^2.0.0-rc.6",
|
"@vue/test-utils": "^2.0.0-rc.7",
|
||||||
"autoprefixer": "^10.2.6",
|
"autoprefixer": "^10.2.6",
|
||||||
"babel-jest": "^27.0.2",
|
|
||||||
"commitizen": "^4.2.4",
|
"commitizen": "^4.2.4",
|
||||||
"conventional-changelog-cli": "^2.1.1",
|
"conventional-changelog-cli": "^2.1.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@ -109,6 +108,7 @@
|
|||||||
"jest": "^27.0.4",
|
"jest": "^27.0.4",
|
||||||
"less": "^4.1.1",
|
"less": "^4.1.1",
|
||||||
"lint-staged": "^11.0.0",
|
"lint-staged": "^11.0.0",
|
||||||
|
"npm-run-all": "^4.1.5",
|
||||||
"postcss": "^8.3.5",
|
"postcss": "^8.3.5",
|
||||||
"prettier": "^2.3.1",
|
"prettier": "^2.3.1",
|
||||||
"pretty-quick": "^3.1.1",
|
"pretty-quick": "^3.1.1",
|
||||||
@ -118,10 +118,11 @@
|
|||||||
"stylelint-config-prettier": "^8.0.2",
|
"stylelint-config-prettier": "^8.0.2",
|
||||||
"stylelint-config-standard": "^22.0.0",
|
"stylelint-config-standard": "^22.0.0",
|
||||||
"stylelint-order": "^4.1.0",
|
"stylelint-order": "^4.1.0",
|
||||||
|
"tailwindcss": "^2.2.2",
|
||||||
"ts-jest": "^27.0.3",
|
"ts-jest": "^27.0.3",
|
||||||
"ts-node": "^10.0.0",
|
"ts-node": "^10.0.0",
|
||||||
"typescript": "4.3.4",
|
"typescript": "4.3.4",
|
||||||
"vite": "2.3.7",
|
"vite": "2.3.8",
|
||||||
"vite-plugin-compression": "^0.2.5",
|
"vite-plugin-compression": "^0.2.5",
|
||||||
"vite-plugin-html": "^2.0.7",
|
"vite-plugin-html": "^2.0.7",
|
||||||
"vite-plugin-imagemin": "^0.3.2",
|
"vite-plugin-imagemin": "^0.3.2",
|
||||||
@ -131,9 +132,7 @@
|
|||||||
"vite-plugin-style-import": "^1.0.0",
|
"vite-plugin-style-import": "^1.0.0",
|
||||||
"vite-plugin-svg-icons": "^0.7.1",
|
"vite-plugin-svg-icons": "^0.7.1",
|
||||||
"vite-plugin-theme": "^0.8.1",
|
"vite-plugin-theme": "^0.8.1",
|
||||||
"vite-plugin-windicss": "^1.0.4",
|
|
||||||
"vue-eslint-parser": "^7.6.0",
|
"vue-eslint-parser": "^7.6.0",
|
||||||
"vue-jest": "^5.0.0-alpha.10",
|
|
||||||
"vue-tsc": "^0.1.7"
|
"vue-tsc": "^0.1.7"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
1742
src/design/tailwind.css
Normal file
1742
src/design/tailwind.css
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,6 @@
|
|||||||
import '/@/design/index.less';
|
import '/@/design/index.less';
|
||||||
|
import '/@/design/tailwind.css';
|
||||||
|
|
||||||
// Register windi
|
|
||||||
import 'virtual:windi.css';
|
|
||||||
// Register icon sprite
|
// Register icon sprite
|
||||||
import 'virtual:svg-icons-register';
|
import 'virtual:svg-icons-register';
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ export interface Emitter {
|
|||||||
|
|
||||||
emit<T = any>(type: EventType, event?: T): void;
|
emit<T = any>(type: EventType, event?: T): void;
|
||||||
emit(type: '*', event?: any): void;
|
emit(type: '*', event?: any): void;
|
||||||
|
clear(): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,5 +89,12 @@ export default function mitt(all?: EventHandlerMap): Emitter {
|
|||||||
handler(type, evt);
|
handler(type, evt);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all
|
||||||
|
*/
|
||||||
|
clear() {
|
||||||
|
this.all.clear();
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
size="small"
|
size="small"
|
||||||
:loading="$attrs.loading"
|
:loading="$attrs.loading"
|
||||||
:title="item.title"
|
:title="item.title"
|
||||||
class="md:w-1/4 w-full !md:mt-0 !mt-4"
|
class="md:w-1/4 w-full md:!mt-0 !mt-4"
|
||||||
:class="[index + 1 < 4 && '!md:mr-4']"
|
:class="[index + 1 < 4 && 'md:!mr-4']"
|
||||||
:canExpan="false"
|
:canExpan="false"
|
||||||
>
|
>
|
||||||
<template #extra>
|
<template #extra>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
<div class="md:flex enter-y">
|
<div class="md:flex enter-y">
|
||||||
<VisitRadar class="md:w-1/3 w-full" :loading="loading" />
|
<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" />
|
<SalesProductPie class="md:w-1/3 w-full" :loading="loading" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-for="item in items" :key="item">
|
<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">
|
<span class="flex">
|
||||||
<Icon :icon="item.icon" :color="item.color" size="30" />
|
<Icon :icon="item.icon" :color="item.color" size="30" />
|
||||||
<span class="text-lg ml-4">{{ item.title }}</span>
|
<span class="text-lg ml-4">{{ item.title }}</span>
|
||||||
|
@ -10,7 +10,11 @@
|
|||||||
<QuickNav :loading="loading" class="enter-y" />
|
<QuickNav :loading="loading" class="enter-y" />
|
||||||
|
|
||||||
<Card class="!my-4 enter-y" :loading="loading">
|
<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>
|
</Card>
|
||||||
|
|
||||||
<SaleRadar :loading="loading" class="enter-y" />
|
<SaleRadar :loading="loading" class="enter-y" />
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
{{ t('sys.login.mobileSignInFormTitle') }}
|
{{ t('sys.login.mobileSignInFormTitle') }}
|
||||||
</Button>
|
</Button>
|
||||||
</ACol>
|
</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)">
|
<Button block @click="setLoginState(LoginStateEnum.QR_CODE)">
|
||||||
{{ t('sys.login.qrSignInFormTitle') }}
|
{{ t('sys.login.qrSignInFormTitle') }}
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -18,7 +18,18 @@ module.exports = {
|
|||||||
'at-rule-no-unknown': [
|
'at-rule-no-unknown': [
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
ignoreAtRules: ['function', 'if', 'each', 'include', 'mixin'],
|
ignoreAtRules: [
|
||||||
|
'tailwind',
|
||||||
|
'apply',
|
||||||
|
'variants',
|
||||||
|
'responsive',
|
||||||
|
'screen',
|
||||||
|
'function',
|
||||||
|
'if',
|
||||||
|
'each',
|
||||||
|
'include',
|
||||||
|
'mixin',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'no-empty-source': null,
|
'no-empty-source': null,
|
||||||
|
@ -1,35 +1,41 @@
|
|||||||
import lineClamp from 'windicss/plugin/line-clamp';
|
const colors = require('tailwindcss/colors');
|
||||||
import colors from 'windicss/colors';
|
|
||||||
|
|
||||||
import { defineConfig } from 'vite-plugin-windicss';
|
module.exports = {
|
||||||
import { primaryColor } from './build/config/themeConfig';
|
mode: 'jit',
|
||||||
|
// darkMode: 'class',
|
||||||
export default defineConfig({
|
plugins: [createEnterPlugin()],
|
||||||
darkMode: 'class',
|
purge: {
|
||||||
plugins: [lineClamp, createEnterPlugin()],
|
enabled: false,
|
||||||
|
content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
extend: {
|
extend: {
|
||||||
colors: {
|
zIndex: {
|
||||||
...colors,
|
'-1': '-1',
|
||||||
primary: primaryColor,
|
|
||||||
},
|
|
||||||
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
|
* 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 = 10) {
|
function createEnterPlugin(maxOutput = 6) {
|
||||||
const createCss = (index: number, d = 'x') => {
|
const createCss = (index, d = 'x') => {
|
||||||
const upd = d.toUpperCase();
|
const upd = d.toUpperCase();
|
||||||
return {
|
return {
|
||||||
[`*> .enter-${d}:nth-child(${index})`]: {
|
[`*> .enter-${d}:nth-child(${index})`]: {
|
Loading…
Reference in New Issue
Block a user