This is a project to demonstrate how to use fonts in SvelteKit.
Two examples are provided:
@fontsource
packageFirst, run the development server:
nvm use # or use Node 22
npm i
npm run dev
Open http://localhost:5173 with your browser to see the result.
To preload fonts, we use the preload
option in handle
in src/hooks.server.ts
. This makes sure all font files are preloaded via <link rel="preload">
tags in the <head>
.
npm run build
node build/index