From b45a10b98f5d6cbdff5bffb5d4ec60a322c9b828 Mon Sep 17 00:00:00 2001 From: xiaoxian521 <1923740402@qq.com> Date: Wed, 10 Nov 2021 09:55:01 +0800 Subject: [PATCH] fix: update --- package.json | 2 +- pnpm-lock.yaml | 8 ++++---- vite.config.ts | 9 ++++++--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index a74762487..74500753d 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "@vue/compiler-sfc": "^3.2.21", "@vue/eslint-config-prettier": "6.0.0", "@vue/eslint-config-typescript": "7.0.0", - "@zougt/vite-plugin-theme-preprocessor": "^1.3.7", + "@zougt/vite-plugin-theme-preprocessor": "^1.3.8", "autoprefixer": "10.2.4", "babel-plugin-transform-remove-console": "6.9.4", "chalk": "2.4.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cdddf78e2..eb4884cab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,7 +20,7 @@ specifiers: "@vue/eslint-config-typescript": 7.0.0 "@vueuse/core": ^6.7.1 "@vueuse/motion": ^2.0.0-beta.4 - "@zougt/vite-plugin-theme-preprocessor": ^1.3.7 + "@zougt/vite-plugin-theme-preprocessor": ^1.3.8 animate.css: ^4.1.1 autoprefixer: 10.2.4 await-to-js: ^3.0.0 @@ -137,7 +137,7 @@ devDependencies: "@vue/compiler-sfc": 3.2.21 "@vue/eslint-config-prettier": 6.0.0_82e4252401b0cc5be86f7c2133946f49 "@vue/eslint-config-typescript": 7.0.0_e03d82996bd4a66fb128f33523d782ea - "@zougt/vite-plugin-theme-preprocessor": 1.3.7_sass@1.43.4 + "@zougt/vite-plugin-theme-preprocessor": 1.3.8_sass@1.43.4 autoprefixer: 10.2.4_postcss@8.2.6 babel-plugin-transform-remove-console: 6.9.4 chalk: 2.4.2 @@ -1540,10 +1540,10 @@ packages: sass: 1.43.4 dev: true - /@zougt/vite-plugin-theme-preprocessor/1.3.7_sass@1.43.4: + /@zougt/vite-plugin-theme-preprocessor/1.3.8_sass@1.43.4: resolution: { - integrity: sha512-ezZQ0cgZlMKyVSRe8cj7P8LDcDhweOolO7by84XvDwcq2Qbfqi/4xTrQI54Q+3lvXHE9J0ausDp0ERGUg0t+pw== + integrity: sha512-2fOaxWgg5Sxs3yiwzGH8DROSMtyCYCbf3B4F63aazayyoyPbVEnJG/f4whkYCFtzaJLiUEmlg3ABpcw9dwz/BA== } engines: { node: ">= 12.0.0" } dependencies: diff --git a/vite.config.ts b/vite.config.ts index 7935d5825..0f01c16eb 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -110,11 +110,14 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => { // 在生产模式是否抽取独立的主题css文件,extract为true以下属性有效 extract: true, // 独立主题css文件的输出路径,默认取 viteConfig.build.assetsDir 相对于 (viteConfig.build.outDir) - outputDir: "", + outputDir: + process.env.NODE_ENV === "production" + ? "/manages/assets/" + : VITE_PUBLIC_PATH, // 会选取defaultScopeName对应的主题css文件在html添加link - themeLinkTagId: "body", + themeLinkTagId: "head", // "head"||"head-prepend" || "body" ||"body-prepend" - themeLinkTagInjectTo: "body", + themeLinkTagInjectTo: "head", // 是否对抽取的css文件内对应scopeName的权重类名移除 removeCssScopeName: false, // 可以自定义css文件名称的函数