Skip to content

Commit

Permalink
feat(client): setup unocss runtime to load icon dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
webfansplz committed Dec 19, 2023
1 parent 190503c commit 12247e7
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"vite": "^3.1.0 || ^4.0.0-0 || ^5.0.0-0"
},
"dependencies": {
"@unocss/preset-icons": "^0.58.0",
"@unocss/runtime": "^0.58.0",
"@vue-devtools-next/core": "workspace:^",
"@vue-devtools-next/kit": "workspace:^",
"@vue-devtools-next/schema": "workspace:*",
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { useDevToolsBridge, useDevToolsState } from '@vue-devtools-next/core'
import { isInChromePanel } from '@vue-devtools-next/shared'
import { Pane, Splitpanes } from 'splitpanes'
import('./setup/unocss-runtime')
// @TODO: fix browser extension cross-origin localStorage issue
useColorMode()
const router = useRouter()
Expand Down
21 changes: 21 additions & 0 deletions packages/client/src/setup/unocss-runtime.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// @ts-expect-error missin types
import presetIcons from '@unocss/preset-icons/browser'
import init from '@unocss/runtime'

init({
defaults: {
presets: [
presetIcons({
prefix: ['i-', ''],
collections: {},
cdn: 'https://esm.sh/',
scale: 1.2,
extraProperties: {
'display': 'inline-block',
'vertical-align': 'middle',
},
}),
],
},
bypassDefined: true,
})
14 changes: 14 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 12247e7

Please sign in to comment.