Files
commonflow.org/astro.config.mjs
Jim Myhrberg e5d2604edc 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>
2026-02-01 02:43:48 +00:00

39 lines
1.0 KiB
JavaScript

import { defineConfig, fontProviders } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
import sitemap from "@astrojs/sitemap";
import icon from "astro-icon";
export default defineConfig({
site: "https://commonflow.org",
outDir: "./dist",
integrations: [sitemap(), icon()],
vite: {
plugins: [tailwindcss()],
},
experimental: {
fonts: [
{
provider: fontProviders.fontsource(),
name: "Bricolage Grotesque",
cssVariable: "--font-bricolage",
weights: ["200 800"],
fallbacks: ["system-ui", "sans-serif"],
},
{
provider: fontProviders.fontsource(),
name: "DM Sans",
cssVariable: "--font-dm-sans",
weights: ["100 1000"],
fallbacks: ["system-ui", "sans-serif"],
},
{
provider: fontProviders.fontsource(),
name: "JetBrains Mono",
cssVariable: "--font-jetbrains",
weights: ["100 800"],
fallbacks: ["SF Mono", "Consolas", "monospace"],
},
],
},
});