Skip to content

Conversation

@asanehisa
Copy link
Contributor

@asanehisa asanehisa commented Feb 3, 2026

Screenshot 2026-02-04 at 1 09 39 PM

custom fonts (both static and variable) are preloaded.

The file paths to preload at are saved the in theme data under __customFontPreloads like:

[
    "/y-fonts/milkdays-regular.woff2",
    "/y-fonts/christmaslights-regular.woff2"
]
Screen.Recording.2026-02-04.at.1.10.07.PM.mov

See live site: https://jovially-similar-mongrel.pgsdemo.com/va/richmond/1101-wilson-blvd (you can hard refresh and custom fonts still don't flash)

@asanehisa asanehisa added the create-dev-release Triggers dev release workflow label Feb 3, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 3, 2026

commit: 5e3d315

@asanehisa asanehisa marked this pull request as ready for review February 4, 2026 18:02
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 4, 2026

Walkthrough

Adds optional custom font support across the visual editor: passes templateMetadata.customFonts into theme editor components, exposes customFonts props on ThemeEditorRightSidebar and ThemeFieldsSidebar, implements utilities to load/index font CSS and build deduplicated preload URL lists, stores preload URLs under __customFontPreloads in theme values, and updates applyTheme to inject tags before font stylesheet links while emitting only CSS-variable keys into the generated style tag.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ThemeEditorRightSidebar
    participant ThemeFieldsSidebar
    participant CustomFontUtils as customFontPreloads
    participant applyTheme
    participant Browser

    User->>ThemeEditorRightSidebar: Open editor / select template
    ThemeEditorRightSidebar->>ThemeFieldsSidebar: Pass customFonts prop
    User->>ThemeFieldsSidebar: Change font selection / update theme
    ThemeFieldsSidebar->>CustomFontUtils: loadCustomFontCssIndex(customFonts)
    CustomFontUtils-->>ThemeFieldsSidebar: customFontCssIndex
    ThemeFieldsSidebar->>CustomFontUtils: buildCustomFontPreloads(themeConfig, themeValues, customFonts, customFontCssIndex)
    CustomFontUtils-->>ThemeFieldsSidebar: preload URL list
    ThemeFieldsSidebar->>ThemeFieldsSidebar: Store __customFontPreloads in theme values
    ThemeFieldsSidebar->>applyTheme: Apply theme (includes __customFontPreloads)
    applyTheme->>CustomFontUtils: getCustomFontPreloads(overrides)
    CustomFontUtils-->>applyTheme: preload URLs
    applyTheme->>Browser: Inject <link rel="preload"> tags
    applyTheme->>Browser: Inject font stylesheet <link> tags
    Browser-->>User: Fonts preloaded before stylesheet fetch/render
Loading

Possibly related PRs

Suggested reviewers

  • briantstephan
  • jwartofsky-yext
  • benlife5
  • mkilpatrick
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main feature: preloading fonts for custom font files to prevent flash of unstyled text.
Description check ✅ Passed The description is directly related to the changeset, explaining the custom font preloading feature with technical details and visual evidence.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch preload-fonts

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 and usage tips.

@asanehisa asanehisa changed the title feat: preload fonts (draft) feat: preload fonts Feb 4, 2026
Copy link
Contributor

@benlife5 benlife5 left a comment

Choose a reason for hiding this comment

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

Nice!

@asanehisa asanehisa merged commit ecc9155 into main Feb 5, 2026
18 checks passed
@asanehisa asanehisa deleted the preload-fonts branch February 5, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

create-dev-release Triggers dev release workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants