1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-11 19:50:24 +08:00

optimize vben/build

This commit is contained in:
源文雨
2023-03-11 16:50:54 +08:00
parent 2a0fdeae31
commit a42e2f450b
18 changed files with 197 additions and 197 deletions

View File

@@ -2,46 +2,46 @@
* Vite plugin for website theme color switching
* https://github.com/anncwb/vite-plugin-theme
*/
import type { PluginOption } from 'vite';
import path from 'path';
import type { PluginOption } from 'vite'
import path from 'path'
import {
viteThemePlugin,
antdDarkThemePlugin,
mixLighten,
mixDarken,
tinycolor,
} from 'vite-plugin-theme';
import { getThemeColors, generateColors } from '../../config/themeConfig';
import { generateModifyVars } from '../../generate/generateModifyVars';
} from 'vite-plugin-theme'
import { getThemeColors, generateColors } from '../../config/themeConfig'
import { generateModifyVars } from '../../generate/generateModifyVars'
export function configThemePlugin(isBuild: boolean): PluginOption[] {
const colors = generateColors({
mixDarken,
mixLighten,
tinycolor,
});
})
const plugin = [
viteThemePlugin({
resolveSelector: (s) => {
s = s.trim();
s = s.trim()
switch (s) {
case '.ant-steps-item-process .ant-steps-item-icon > .ant-steps-icon':
return '.ant-steps-item-icon > .ant-steps-icon';
return '.ant-steps-item-icon > .ant-steps-icon'
case '.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled)':
case '.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover':
case '.ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):active':
return s;
return s
case '.ant-steps-item-icon > .ant-steps-icon':
return s;
return s
case '.ant-select-item-option-selected:not(.ant-select-item-option-disabled)':
return s;
return s
default:
if (s.indexOf('.ant-btn') >= -1) {
// 按钮被重新定制过需要过滤掉class防止覆盖
return s;
return s
}
}
return s.startsWith('[data-theme') ? s : `[data-theme] ${s}`;
return s.startsWith('[data-theme') ? s : `[data-theme] ${s}`
},
colorVariables: [...getThemeColors(), ...colors],
}),
@@ -83,7 +83,7 @@ export function configThemePlugin(isBuild: boolean): PluginOption[] {
'alert-error-icon-color': '#a61d24',
},
}),
];
]
return plugin as unknown as PluginOption[];
return plugin as unknown as PluginOption[]
}