feat: preload fonts (#13068)

This commit is contained in:
martin
2024-10-01 04:08:25 +02:00
committed by GitHub
parent f0ad6627a5
commit 06048b6db9
3 changed files with 14 additions and 1 deletions

12
web/src/hooks.server.ts Normal file
View File

@@ -0,0 +1,12 @@
import overpass from '$lib/assets/fonts/overpass/Overpass.ttf?url';
import overpassMono from '$lib/assets/fonts/overpass/OverpassMono.ttf?url';
import type { Handle } from '@sveltejs/kit';
// only used during the build to replace the variables from app.html
export const handle = (async ({ event, resolve }) => {
return resolve(event, {
transformPageChunk: ({ html }) => {
return html.replace('%app.font%', overpass).replace('%app.monofont%', overpassMono);
},
});
}) satisfies Handle;