Skip to content

fix(fonts): self-host DM Sans instead of loading it from Google Fonts - #30

Merged
viganogabriele merged 1 commit into
mainfrom
lorenzocorallo/self-host-fonts
Oct 18, 2026
Merged

viganogabriele merged 1 commit into
mainfrom
lorenzocorallo/self-host-fonts

Conversation

@lorenzocorallo

Copy link
Copy Markdown
Member

What

  • DM Sans is now served from public/fonts/dm-sans/ (same layout as the HugeIcons font): the two woff2 files (latin, latin-ext) and @font-face rules that Google Fonts served for DM+Sans:opsz,wght@9..40,400..700, plus the OFL licence.
  • index.html loads /fonts/dm-sans/dm-sans.css with the same non-blocking media="print" trick and <noscript> fallback. The Google preconnect hints are gone.
  • CSP: removed https://fonts.googleapis.com from style-src and https://fonts.gstatic.com from font-src.
  • README: Google Fonts is no longer listed as a third-party request.

Family name ("DM Sans"), axes (opsz 9–40, wght 400–700), unicode-range and font-display: swap are unchanged, so the design renders the same.

Why

Privacy: loading fonts from Google Fonts sends every visitor's IP address to Google. With the fonts self-hosted, Google no longer needs to be listed as a data recipient in the PoliNetwork privacy policy.

Verification

  • pnpm lint, pnpm test, pnpm typecheck, pnpm build: all pass
  • grep -ri "googleapis\|gstatic" dist: no matches
  • dist/fonts/dm-sans/ contains dm-sans-latin.woff2 and dm-sans-latin-ext.woff2

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4c7949f7-34d9-4a63-81a3-6236af446418
📥 Commits

Reviewing files that changed from the base of the PR and between 8f5998c and 9b2596a.

⛔ Files ignored due to path filters: 2
  • public/fonts/dm-sans/dm-sans-latin-ext.woff2 is excluded by !**/*.woff2
  • public/fonts/dm-sans/dm-sans-latin.woff2 is excluded by !**/*.woff2
📒 Files selected for processing: 4
  • README.md
  • index.html
  • public/fonts/dm-sans/OFL.txt
  • public/fonts/dm-sans/dm-sans.css

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

DM Sans is now loaded from local WOFF2 files through a local stylesheet. The CSP no longer allows Google Fonts origins, and the README lists DM Sans as self-hosted.

Changes

Self-hosted DM Sans

Layer / File(s) Summary
Local font declarations and license
public/fonts/dm-sans/dm-sans.css, public/fonts/dm-sans/OFL.txt
Adds local DM Sans font-face rules for Latin and Latin-ext, weights 400–700, with font-display: swap. Adds the SIL Open Font License 1.1 text.
Page loading and CSP
index.html, README.md
Loads the local DM Sans stylesheet with a local noscript fallback and removes Google Fonts origins from the CSP. The README identifies DM Sans and HugeIcons as self-hosted.

Priority: ➖ Normal

Change: Refactor

Merge Risk: ⚪ Minimal · up to 9b259

DM Sans is served from local files, and the inspected assets support the declared faces. No actionable merge-blocking issue remains.

Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: replacing Google Fonts delivery with a self-hosted DM Sans font.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@viganogabriele
viganogabriele self-requested a review October 18, 2026 08:49
@viganogabriele
viganogabriele merged commit 812a7a4 into main Oct 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants