mirror of
https://github.com/jimeh/commonflow.org.git
synced 2026-02-19 05:46:40 +00:00
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>
39 lines
1.0 KiB
JavaScript
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"],
|
|
},
|
|
],
|
|
},
|
|
});
|