Skip to content

perf: Load fonts with font-display swap, preloads and caching#889

Open
lfrancke wants to merge 1 commit into
mainfrom
perf/fonts-and-caching
Open

perf: Load fonts with font-display swap, preloads and caching#889
lfrancke wants to merge 1 commit into
mainfrom
perf/fonts-and-caching

Conversation

@lfrancke

@lfrancke lfrancke commented Jul 16, 2026

Copy link
Copy Markdown
Member

Description

First slice of the performance batch from the docs overhaul plan (mobile Lighthouse baseline: Performance 79, FCP 3.1 s, LCP 4.4 s - almost entirely loading, TBT/CLS are already 0):

  • font-display: swap on all six @font-face rules in fonts.css - text renders immediately in the fallback font instead of waiting for webfonts (Lighthouse estimates ~400 ms). Also fixes the stale gulp reference in that file's comment.
  • Preload the two above-the-fold fonts (Noto Sans 400 for body, IBM Plex Mono 600 for headings) in head-styles.hbs, so the swap window is usually invisible in practice.
  • Cache-Control: max-age=86400 for /_/* via netlify.toml (the cache-lifetimes finding). One day, deliberately not longer: the bundle file names aren't content-hashed, so this bounds the stale-css window after a deploy.

The remaining Lighthouse items (Font Awesome removal, conditional Mermaid, deferred Pagefind) are separate follow-up PRs.

@netlify

netlify Bot commented Jul 16, 2026

Copy link
Copy Markdown

Deploy Preview for stackable-docs ready!

Name Link
🔨 Latest commit 7af036a
🔍 Latest deploy log https://app.netlify.com/projects/stackable-docs/deploys/6a588970927483000800c0ba
😎 Deploy Preview https://deploy-preview-889--stackable-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Mobile Lighthouse attributes ~400 ms of first-paint delay to the fonts
blocking text rendering:

- font-display: swap on all six faces, so text renders in the fallback
  font until the webfonts arrive.
- Preload the two above-the-fold fonts (body Noto Sans 400 and heading
  IBM Plex Mono 600), so they usually arrive before first paint anyway.
- Cache the UI bundle assets for a day via netlify.toml headers (the
  Lighthouse cache-lifetimes finding; a day keeps a stale-css window
  after deploys short since the file names are not content-hashed).
@lfrancke lfrancke force-pushed the perf/fonts-and-caching branch from ebb98f1 to 7af036a Compare July 16, 2026 07:34
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.

1 participant