mirror of
https://github.com/immich-app/immich.git
synced 2024-12-28 22:51:59 +00:00
feat: preload fonts (#13068)
This commit is contained in:
parent
f0ad6627a5
commit
06048b6db9
3 changed files with 14 additions and 1 deletions
|
@ -23,7 +23,6 @@ export const ONE_HOUR = Duration.fromObject({ hours: 1 });
|
|||
export const envName = (process.env.IMMICH_ENV || 'production').toUpperCase();
|
||||
export const isDev = () => process.env.IMMICH_ENV === 'development';
|
||||
export const APP_MEDIA_LOCATION = process.env.IMMICH_MEDIA_LOCATION || './upload';
|
||||
export const WEB_ROOT = process.env.IMMICH_WEB_ROOT || '/usr/src/app/www';
|
||||
const HOST_SERVER_PORT = process.env.IMMICH_PORT || '2283';
|
||||
export const DEFAULT_EXTERNAL_DOMAIN = 'http://localhost:' + HOST_SERVER_PORT;
|
||||
|
||||
|
|
|
@ -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…
Reference in a new issue