Skip to content

Commit 819c56d

Browse files
committed
added custom font useage in examples
1 parent c7f1aa3 commit 819c56d

11 files changed

+18
-74
lines changed
79.3 KB
Binary file not shown.
79.3 KB
Binary file not shown.
Binary file not shown.
79.3 KB
Binary file not shown.

example/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<body>
99
<h1>Hello Vite!</h1>
1010
<a href="https://vitejs.dev/guide/features.html" target="_blank">Documentation</a>
11+
<h3>I'm using a local font !</h3>
1112
<script type="module" src="/main.ts"></script>
1213
</body>
1314
</html>

example/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
import 'virtual:fonts.css'
12
import './style.css'

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "0.0.0",
44
"scripts": {
55
"dev": "vite",
6-
"build": "vite build"
6+
"build": "vite build",
7+
"preview": "vite preview"
78
},
89
"devDependencies": {
910
"vite": "^2.0.0",

example/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ body {
1010
a {
1111
font-family: "Open Sans", Avenir, Helvetica, Arial, sans-serif;
1212
}
13+
14+
h3 {
15+
font-family: "Dancing Script", sans-serif;
16+
font-size: 3rem;
17+
font-weight: 600;
18+
}
19+

example/vite.config.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default defineConfig({
77
google: {
88
families: ['Crimson Pro', 'Open Sans', 'Material+Icons'],
99
},
10+
11+
custom: {
12+
families: {
13+
'Dancing Script': './assets/fonts/DancingScript-*.ttf',
14+
},
15+
},
1016
}),
1117
],
1218
})

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"dev": "npm run build -- --watch",
1616
"example:dev": "npm -C example run dev",
1717
"example:build": "npm -C example run build",
18+
"example:preview": "npm -C example run preview",
1819
"build": "tsup src/index.ts --dts --format cjs,esm",
1920
"lint": "eslint --ext .ts ./src",
2021
"lint:fix": "eslint --fix --ext .ts ./src"

0 commit comments

Comments
 (0)