From e1d23f27a0c2be1c3975234453d5bb7de8c80e4c Mon Sep 17 00:00:00 2001 From: Magnus Madsen Date: Mon, 3 Aug 2026 07:10:40 +0200 Subject: [PATCH] perf: self-host Open Sans instead of loading from Google Fonts Replace the Google Fonts stylesheet and preconnect links with the @fontsource/open-sans package, bundled by Astro like Bootstrap already is. Same unicode-range subsetting, so download size is unchanged, but pages no longer contact fonts.googleapis.com / fonts.gstatic.com. Co-Authored-By: Claude Fable 5 --- package-lock.json | 10 ++++++++++ package.json | 1 + src/layouts/Layout.astro | 4 +--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index c1bfc03..5dbe201 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.2.0", "dependencies": { "@astrojs/sitemap": "^3.7.3", + "@fontsource/open-sans": "^5.3.0", "@iconify-json/fa-brands": "^1.2.2", "@iconify-json/fa-solid": "^1.2.2", "@iconify-json/mdi": "^1.2.3", @@ -1147,6 +1148,15 @@ "node": ">=18" } }, + "node_modules/@fontsource/open-sans": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@fontsource/open-sans/-/open-sans-5.3.0.tgz", + "integrity": "sha512-V1bdMlGNyZrJwzrdusshMOw2YR0aqYDL7kOo9dkxUEKl8dFv66A9HLckOOXl572sG/7ohhDQrCrTFGSn9LZcSw==", + "license": "OFL-1.1", + "funding": { + "url": "https://github.com/sponsors/ayuhito" + } + }, "node_modules/@iconify-json/fa-brands": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/@iconify-json/fa-brands/-/fa-brands-1.2.2.tgz", diff --git a/package.json b/package.json index e4e483d..e6f3954 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ }, "dependencies": { "@astrojs/sitemap": "^3.7.3", + "@fontsource/open-sans": "^5.3.0", "@iconify-json/fa-brands": "^1.2.2", "@iconify-json/fa-solid": "^1.2.2", "@iconify-json/mdi": "^1.2.3", diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index 79625db..424f1b0 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -1,5 +1,6 @@ --- import 'bootstrap/dist/css/bootstrap.min.css'; +import '@fontsource/open-sans/400.css'; const { title } = Astro.props; const currentPath = Astro.url.pathname; @@ -26,9 +27,6 @@ import '../styles/global.css'; {title} - - -