Skip to content

Commit

Permalink
fix: 修复本地化图标空白问题
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Jan 31, 2024
1 parent 03580b0 commit 14ff83a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .env.pro
Expand Up @@ -35,4 +35,4 @@ VITE_USE_MOCK=true
VITE_USE_CSS_SPLIT=true

# 是否使用在线图标
VITE_USE_ONLINE_ICON=true
VITE_USE_ONLINE_ICON=false
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -11,7 +11,7 @@
"build:pro": "pnpm vite build --mode pro",
"build:gitee": "pnpm vite build --mode gitee",
"build:dev": "pnpm vite build --mode dev",
"build:test": "pnpm run ts:check && vite build --mode test",
"build:test": "pnpm vite build --mode test",
"serve:pro": "pnpm vite preview --mode pro",
"serve:dev": "pnpm vite preview --mode dev",
"serve:test": "pnpm vite preview --mode test",
Expand Down
16 changes: 13 additions & 3 deletions uno.config.ts
@@ -1,16 +1,26 @@
import { defineConfig, toEscapedSelector as e, presetUno, presetIcons } from 'unocss'
import transformerVariantGroup from '@unocss/transformer-variant-group'
import { loadEnv } from 'vite'

const root = process.cwd()

const createPresetIcons = () => {
const isBuild = !!process.argv[4]
let env = {} as any
if (!isBuild) {
env = loadEnv(process.argv[4], root)
} else {
env = loadEnv(process.argv[3], root)
}
// @ts-ignore
if (import.meta.env.VITE_USE_ONLINE_ICON === 'true') {
if (env.VITE_USE_ONLINE_ICON === 'true') {
return []
} else {
return [
presetIcons({
prefix: ''
})
]
} else {
return []
}
}

Expand Down

0 comments on commit 14ff83a

Please sign in to comment.