mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat: preload fonts (#13068)
This commit is contained in:
parent
f0ad6627a5
commit
06048b6db9
3 changed files with 14 additions and 1 deletions
|
|
@ -13,6 +13,8 @@
|
|||
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96.png" />
|
||||
<link rel="icon" type="image/png" sizes="144x144" href="/favicon-144.png" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-icon-180.png" />
|
||||
<link rel="preload" as="font" type="font/ttf" href="%app.font%" />
|
||||
<link rel="preload" as="font" type="font/ttf" href="%app.monofont%" />
|
||||
%sveltekit.head%
|
||||
<style>
|
||||
/* prevent FOUC */
|
||||
|
|
|
|||
12
web/src/hooks.server.ts
Normal file
12
web/src/hooks.server.ts
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue