Skip to content

Commit f640931

Browse files
authored
stop preloading fonts willy-nilly (#394)
* stop preloading fonts willy-nilly * tighten up further
1 parent 1ef24d9 commit f640931

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

apps/svelte.dev/src/hooks.server.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@ export async function handle({ event, resolve }) {
2121
}
2222

2323
const response = await resolve(event, {
24-
preload: ({ type }) => type === 'js' || type === 'css' || type === 'font'
24+
preload: ({ type, path }) => {
25+
if (type === 'font') {
26+
// only preload header font, everything else is lower priority,
27+
// otherwise it causes congestion that messes up LCP
28+
return path.includes('dm-serif-display-latin-400-normal') && path.endsWith('.woff2');
29+
}
30+
31+
return true;
32+
}
2533
});
2634

2735
return response;

0 commit comments

Comments
 (0)