Skip to content

Commit ace0483

Browse files
committed
fix: app dev & font local
1 parent 6ef50db commit ace0483

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"start": "vite preview",
1616
"app:start": "electron-vite preview",
1717
"dev": "vite dev",
18-
"dev:app": "electron-vite dev",
18+
"app:dev": "electron-vite dev",
1919
"build": "electron-vite build",
2020
"test": "vitest --coverage",
2121
"test:run": "vitest run",
@@ -63,6 +63,7 @@
6363
"@unocss/eslint-config": "^66.1.2",
6464
"@unocss/eslint-plugin": "^66.1.2",
6565
"@unocss/preset-mini": "^66.1.2",
66+
"@unocss/preset-web-fonts": "^66.1.2",
6667
"@unocss/preset-wind3": "^66.1.2",
6768
"@unocss/reset": "^66.1.2",
6869
"@vitejs/plugin-vue": "^5.2.4",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uno.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { PresetOrFactoryAwaitable } from 'unocss'
22

33
import { colorToString } from '@unocss/preset-mini/utils'
4+
import { createLocalFontProcessor } from '@unocss/preset-web-fonts/local'
45
import { defineConfig, mergeConfigs, presetAttributify, presetIcons, presetTypography, presetWebFonts, presetWind3, transformerDirectives, transformerVariantGroup } from 'unocss'
56
import presetAnimations from 'unocss-preset-animations'
67
import { presetScrollbar } from 'unocss-preset-scrollbar'
@@ -98,6 +99,15 @@ export function sharedUnoConfig() {
9899
warning: 5000,
99100
failure: 10000,
100101
},
102+
// This will download the fonts and serve them locally
103+
processors: createLocalFontProcessor({
104+
// Directory to cache the fonts
105+
cacheDir: 'node_modules/.cache/unocss/fonts',
106+
// Directory to save the fonts assets
107+
fontAssetsDir: 'public/assets/fonts',
108+
// Base URL to serve the fonts from the client
109+
fontServeBaseUrl: '/assets/fonts',
110+
}),
101111
}),
102112
presetIcons({
103113
scale: 1.2,

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Layouts from 'vite-plugin-vue-layouts'
99

1010
// https://vitejs.dev/config/
1111
export default defineConfig(async () => ({
12+
root: resolve(join('src', 'renderer')),
1213
optimizeDeps: {
1314
exclude: [
1415
'@proj-airi/ui',

0 commit comments

Comments
 (0)