加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.js 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
就眠儀式 提交于 2021-11-12 09:18 . 💗 修复主题色动态切换
import { resolve } from 'path/posix';
import { defineConfig } from 'vite';
import vue from "@vitejs/plugin-vue";
import visualizer from "rollup-plugin-visualizer";
import path from 'path'
import themePreprocessorPlugin from "@zougt/vite-plugin-theme-preprocessor";
const plugins = [vue(),
themePreprocessorPlugin({
less: {
// 各个主题文件的位置
multipleScopeVars: [
{
scopeName: "theme-blue",
path: path.resolve("src/assets/theme/blue.less"),
},{
scopeName: "theme-green",
path: path.resolve("src/assets/theme/green.less"),
}, {
scopeName: "theme-yellow",
path: path.resolve("src/assets/theme/yellow.less"),
}, {
scopeName: "theme-red",
path: path.resolve("src/assets/theme/red.less"),
}, {
scopeName: "theme-purple",
path: path.resolve("src/assets/theme/purple.less"),
}
],
},
})
];
if (process.env.vis) {
plugins.push(
visualizer({
open: true,
gzipSize: true,
brotliSize: true,
})
);
}
export default defineConfig({
plugins,
server: {
port: 8080
},
resolve: {
alias: {
'@': resolve('src')
}
},
// 开启less支持
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
},
hmr: {
overlay: false
}
})
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化