feat: migrate to Astro's experimental font API

Replace @fontsource-variable NPM packages with Astro's built-in
experimental font API using the Fontsource provider. Fonts are now
fetched at build time, cached locally, and served with the site.

This provides automatic @font-face generation, preload link injection,
and metric-adjusted fallback fonts (size-adjust, ascent-override, etc.)
to reduce CLS during font loading.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 02:43:48 +00:00
parent e85a83c2c6
commit e5d2604edc
5 changed files with 119 additions and 70 deletions

View File

@@ -8,10 +8,10 @@
--color-accent: theme(colors.sky.500);
--color-accent-light: theme(colors.sky.400);
/* Fonts - self-hosted via fontsource */
--font-display: "Bricolage Grotesque Variable", system-ui, sans-serif;
--font-sans: "DM Sans Variable", system-ui, sans-serif;
--font-mono: "JetBrains Mono Variable", "SF Mono", Consolas, monospace;
/* Fonts - via Astro experimental font API (fontsource provider) */
--font-display: var(--font-bricolage);
--font-sans: var(--font-dm-sans);
--font-mono: var(--font-jetbrains);
/* Sizing */
--header-height: 4rem;