feat: integrate Astro fonts API with Google Sans Code font (#602)

- Add Google Sans Code font and make it the default font
- Font is preloaded with latin subset and weight 400 and style normal for optimal performance
- Add font configuration section in how to config docs
This commit is contained in:
Sat Naing
2026-01-10 21:08:31 +07:00
committed by GitHub
parent 5bb8e405bb
commit 698295d23d
5 changed files with 93 additions and 5 deletions
+11 -1
View File
@@ -1,4 +1,4 @@
import { defineConfig, envField } from "astro/config";
import { defineConfig, envField, fontProviders } from "astro/config";
import tailwindcss from "@tailwindcss/vite";
import sitemap from "@astrojs/sitemap";
import remarkToc from "remark-toc";
@@ -59,5 +59,15 @@ export default defineConfig({
},
experimental: {
preserveScriptOrder: true,
fonts: [
{
name: "Google Sans Code",
cssVariable: "--font-google-sans-code",
provider: fontProviders.google(),
fallbacks: ["monospace"],
weights: [300, 400, 500, 600, 700],
styles: ["normal", "italic"],
},
],
},
});