Public: anyone can read this; the crew can change it.
Own the fonts: serve Inter from this site, not Google #33
Check · Review · Land · Live done — Landed and live in production.
Inter is now served from this site, and the page no longer references Google. `bun test` passes (7 tests). I did not load the page in a browser, so the "same look" and "no off-origin requests" checks are still open.
shipped production is serving it deploy 8fde824
Inter is now served from this site, and the page no longer references Google. bun test passes (7 tests). I did not load the page in a browser, so the "same look" and "no off-origin requests" checks are still open.
- Font file:
public/fonts/inter-5.3.0-latin.woff2is the variable woff2, latin subset, 48 KB. I could not reach Google from the sandbox. I took the file from the@fontsource-variable/inter5.3.0 npm package, which is the same upstream Inter. The OFL licence is next to it inpublic/fonts/inter-LICENSE.txt. - Page:
public/index.htmldrops the two Google preconnects and the stylesheet link. It adds a preload for the woff2. - CSS:
public/style.cssgets an@font-facefor Inter at weights 100–900 withfont-display: swapand the latinunicode-range. Thefont-familystack is unchanged. It is now a variable font, so 400, 500 and 700 render from the same file. - Server: in
src/server.tsthe CSP is nowstyle-src 'self'; font-src 'self'. I added awoff2MIME type. Fonts are cached for a year as immutable, which is safe because the file name carries the Inter version. - Tests:
test/server.test.tsnow asserts the CSP and the HTML contain nogoogleorgstatic, and thatfont-src 'self'is set. A new test checks the font is served asfont/woff2with an immutable cache header. - README: a short Fonts section covers where the font comes from and why the file name is versioned.
I did not run bun x tsc --noEmit: the repo has no tsconfig.json or package.json, so it only printed tsc's help text. There is no scripts/gate.ts, scripts/fast.ts or docs/VISION.md in this repo, so I skipped those steps. I did not touch public/site.js or public/sky.js.
To try it, open the preview with the network panel filtered by domain. You should see only the preview origin (plus the forge's /live call), and the Inter woff2 should load from /fonts/.
Verified on the preview: the HTML has no Google references or preconnects, and the font is preloaded from /fonts/. The woff2 is served as font/woff2 with cache-control public, max-age=31536000, immutable. The CSP is now style-src and font-src 'self' with no Google hosts. No inline <style> or style= attributes exist, so the tighter style-src breaks nothing; site.js sets styles through CSSOM, which CSP allows. The @font-face is variable 100-900 with swap, the font-family stack is unchanged, the OFL licence ships beside the file, and the tests cover the CSP, the HTML and the font response. I could not render the page in a browser, so the visual match is unchecked.
Two things I would do next:
- Add size-adjust, ascent-override and descent-override on a local fallback face, so the swap from the system font to Inter causes no layout shift on first paint. A preload already narrows the gap.
- Add a test that every /fonts/ URL referenced in style.css and index.html resolves to 200, so a version bump that renames the file cannot leave a broken preload.
Inter is now served from this site, and the page no longer references Google.
bun testpasses (7 tests). I did not load the page in a browser, so the "same look" and "no off-origin requests" checks are still open.public/fonts/inter-5.3.0-latin.woff2is the variable woff2, latin subset, 48 KB. I could not reach Google from the sandbox. I took the file from the@fontsource-variable/inter5.3.0 npm package, which is the same upstream Inter. The OFL licence is next to it inpublic/fonts/inter-LICENSE.txt.public/index.htmldrops the two Google preconnects and the stylesheet link. It adds a preload for the woff2.public/style.cssgets an@font-facefor Inter at weights 100–900 withfont-display: swapand the latinunicode-range. Thefont-familystack is unchanged. It is now a variable font, so 400, 500 and 700 render from the same file.src/server.tsthe CSP is nowstyle-src 'self'; font-src 'self'. I added awoff2MIME type. Fonts are cached for a year as immutable, which is safe because the file name carries the Inter version.test/server.test.tsnow asserts the CSP and the HTML contain nogoogleorgstatic, and thatfont-src 'self'is set. A new test checks the font is served asfont/woff2with an immutable cache header.I did not run
bun x tsc --noEmit: the repo has notsconfig.jsonorpackage.json, so it only printed tsc's help text. There is noscripts/gate.ts,scripts/fast.tsordocs/VISION.mdin this repo, so I skipped those steps. I did not touchpublic/site.jsorpublic/sky.js.To try it, open the preview with the network panel filtered by domain. You should see only the preview origin (plus the forge's
/livecall), and the Inter woff2 should load from/fonts/.Closes #29