diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index cd4c812b..55d779ff 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -6,8 +6,6 @@ import type { Plugin, ConfigEnv } from 'vite'; // 按需加载样式配置 import { configStylePlugin } from './style'; -// 主题切换配置 -// import { configThemePlugin } from './theme'; // svg配置 import { configSvgPlugin } from './svg'; // 压缩 @@ -31,8 +29,6 @@ export function createVitePlugins(isBuild = false, _configEnv: ConfigEnv) { vitePlugins.push(configStylePlugin()); - // vitePlugins.push(configThemePlugin()); - vitePlugins.push(configSvgPlugin()); vitePlugins.push(configCompressPlugin('gzip', true)); diff --git a/build/vite/plugin/theme.ts b/build/vite/plugin/theme.ts deleted file mode 100644 index 7716151a..00000000 --- a/build/vite/plugin/theme.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * 动态改变主题 - * https://github.com/GitOfZGT/vite-plugin-theme-preprocessor - */ - -import type { Plugin } from 'vite'; - -import path from 'path'; -import { themePreprocessorPlugin } from '@zougt/vite-plugin-theme-preprocessor'; -// 此配置暂时禁止使用(原因不支持ts) - -export function configThemePlugin(): Plugin | Plugin[] { - const options = { - scss: { - multipleScopeVars: [ - { - scopeName: 'variables-theme-day', - path: path.resolve('src/styles/variables-day.scss'), - }, - { - scopeName: 'variables-theme-dark', - path: path.resolve('src/styles/variables-dark.scss'), - }, - ], - // 默认取 multipleScopeVars[0].scopeName - defaultScopeName: '', - // 在生产模式是否抽取独立的主题css文件,extract为true以下属性有效 - extract: false, - // 独立主题css文件的输出路径,默认取 viteConfig.build.assetsDir 相对于 (viteConfig.build.outDir) - outputDir: '', - // 会选取defaultScopeName对应的主题css文件在html添加link - themeLinkTagId: 'theme-link-tag', - // "head"||"head-prepend" || "body" ||"body-prepend" - themeLinkTagInjectTo: 'head', - // 是否对抽取的css文件内对应scopeName的权重类名移除 - removeCssScopeName: false, - // 可以自定义css文件名称的函数 - customThemeCssFileName: (scopeName: string) => scopeName, - }, - // less: { - // multipleScopeVars: [ - // { - // scopeName: "theme-default", - // path: path.resolve("src/theme/default-vars.less"), - // }, - // { - // scopeName: "theme-mauve", - // path: path.resolve("src/theme/mauve-vars.less"), - // }, - // ], - // }, - }; - const plugin: Plugin[] = [themePreprocessorPlugin(options)]; - - return plugin; -} diff --git a/src/components/Application/AppTheme.vue b/src/components/Application/AppTheme.vue index 24607bc6..83c0ff89 100644 --- a/src/components/Application/AppTheme.vue +++ b/src/components/Application/AppTheme.vue @@ -9,32 +9,18 @@