Skip to content

perf(homepage): stabilize font loading [Codex] - #1360

Draft
jderochervlk wants to merge 3 commits into
refactor/homepage-componentsfrom
perf/homepage-font-loading
Draft

jderochervlk wants to merge 3 commits into
refactor/homepage-componentsfrom
perf/homepage-font-loading

Conversation

@jderochervlk

@jderochervlk jderochervlk commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

Context

The homepage currently discovers Red Hat Mono from a Google Fonts stylesheet rendered inside the hero body. That creates a late cross-origin stylesheet-to-font waterfall, while the critical Inter faces are discovered only after the main stylesheet, making the first-visit font swap visible.

This is the third layer in stack #1359, based on #1358, and contributes to #1354.

Changes

  • self-host the Latin Red Hat Mono 700 face and include its OFL license
  • export homepage route links that preload Inter Regular, Inter SemiBold, and Red Hat Mono with matching font and CORS metadata
  • remove the body-level Google Fonts stylesheet and keep homepage-only font hints out of other routes
  • add prerender and production-browser coverage for head placement, successful font loading, and same-origin requests
  • ratchet the homepage bundle ceilings to the new generated output

Impact

The external stylesheet and two-origin font waterfall are removed, and the three first-viewport faces begin loading directly from the document head. Compared with the preceding stack layer, route metadata adds 187 raw bytes and 22 gzip bytes of JavaScript; the local font-face declaration adds 291 raw bytes and 20 gzip bytes of CSS. DOM and media counts are unchanged.

@jderochervlk
jderochervlk added this pull request to stack #1359 September 18, 2026 12:34
@jderochervlk jderochervlk changed the title perf/homepage font loading perf(homepage): stabilize font loading [Codex] Sep 18, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 18, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
guide 2f60272 Commit Preview URL

Branch Preview URL
Sep 18 2026, 02:20 PM

@jderochervlk

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-18T12:44:10.742946Z 69f5c8f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 69f5c8f98f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


let links = () => [
fontPreload("/fonts/subset-Inter-Regular.woff2"),
fontPreload("/fonts/subset-Inter-SemiBold.woff2"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preload the bold desktop headline face

At the lg breakpoint, the homepage's hl-title switches to font-bold, so the prominent H1 uses Inter 700 rather than this preloaded 600 face. On desktop—the default Playwright viewport and a key performance scenario—the browser therefore still discovers /fonts/subset-Inter-Bold.woff2 only after parsing the stylesheet, leaving the headline font swap this change is intended to prevent. Add the 700 face to the preload set and exercise it in the font-loading assertion.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Lighthouse baseline

Compared with target branch refactor/homepage-components at commit 8919781. Scores are the median of 3 runs against the deployed Cloudflare preview.

Category Target Current Change
Performance 83 78 -5
Accessibility 74 74 0
Best practices 100 100 0
SEO 50 50 0

Download the full Lighthouse reports and baseline

Commit f4afeef · Cloudflare preview

@jderochervlk
jderochervlk force-pushed the perf/homepage-font-loading branch from f0b152e to 501f880 Compare September 18, 2026 13:51
@github-actions

Copy link
Copy Markdown
Contributor

Guide Cloudflare deployment

⛅️ wrangler 4.130.0
────────────────────
🌀 Building list of assets...
✨ Read 17 files from the assets directory /home/runner/work/rescript-lang.org/rescript-lang.org/apps/guide/build/client
🌀 Starting asset upload...
No updated asset files to upload. Proceeding with deployment...
Total Upload: 0.31 KiB / gzip: 0.22 KiB
Worker Startup Time: 0 ms
Uploaded guide (1.45 sec)
Worker Version ID: ebc9bdea-7050-4752-af01-b7e1ff04b0e4
Version Preview URL: https://ebc9bdea-guide.rescript.workers.dev
Version Preview Alias URL: https://perf-homepage-font-loading-guide.rescript.workers.dev

To deploy this version to production traffic use the command wrangler versions deploy

Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy

Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy

@github-actions

Copy link
Copy Markdown
Contributor

Guide Cloudflare deployment

⛅️ wrangler 4.130.0
────────────────────
🌀 Building list of assets...
✨ Read 17 files from the assets directory /home/runner/work/rescript-lang.org/rescript-lang.org/apps/guide/build/client
🌀 Starting asset upload...
No updated asset files to upload. Proceeding with deployment...
Total Upload: 0.31 KiB / gzip: 0.22 KiB
Worker Startup Time: 0 ms
Uploaded guide (1.59 sec)
Worker Version ID: c7c59f12-247b-44c1-b83d-1b715a429e00
Version Preview URL: https://c7c59f12-guide.rescript.workers.dev
Version Preview Alias URL: https://perf-homepage-font-loading-guide.rescript.workers.dev

To deploy this version to production traffic use the command wrangler versions deploy

Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy

Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy

@github-actions

Copy link
Copy Markdown
Contributor

Cloudflare deployment

Deployement ID: c03f8ca5-f857-42d7-80ee-c24da6b47b5e
Deployment Environment: preview

⛅️ wrangler 4.130.0
────────────────────
✨ Compiled Worker successfully
Uploading... (8882/8884)
Uploading... (8883/8884)
Uploading... (8884/8884)
✨ Success! Uploaded 2 files (8882 already uploaded) (0.97 sec)

✨ Uploading _redirects
✨ Uploading Functions bundle
🌎 Deploying...
✨ Deployment complete! Take a peek over at https://c03f8ca5.rescript-lang.pages.dev
✨ Deployment alias URL: https://perf-homepage-font-loading.rescript-lang.pages.dev

Self-host the homepage Red Hat Mono face and preload the three critical first-viewport fonts through the route links export. Keep font requests on the local origin and cover the preload contract in production Playwright tests.
Record the initial bundle sizes produced by the font-loading layer after rebasing the stack onto the latest master.
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview

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