support custom font url in branding config#496
Draft
Coleton (Locrian24) wants to merge 1 commit into
Draft
Conversation
When BrandingConfiguration.main.customFontUrl is set, inject an @font-face block (registered under brandFont as the family name) via a <style id=brandFontStylesheet> tag instead of the Google Fonts <link>. Format inferred from the URL extension (woff2/ttf/otf). Both paths share the same DOM id so swapping modes replaces cleanly. customFontUrl is plumbed through parseBrandingConfig and the postMessage live-update path in global.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Companion to the portalv2 PR adding custom font support to branding: https://github.com/saasquatch/saasquatch/pull/new/font-uploading
When
BrandingConfiguration.main.customFontUrlis set, inject an@font-faceblock (registered underbrandFontas the family name) via a<style id="brandFontStylesheet">tag instead of the Google Fonts<link>. Format is inferred from the URL extension:.woff2→format("woff2").woff→format("woff").ttf→format("truetype").otf→format("opentype")format(...)(browser sniffs)Both code paths (Google
<link>and custom<style>) share the same DOM id so toggling modes replaces the element cleanly.customFontUrlis plumbed throughparseBrandingConfiginglobal/styles.tsand the postMessage live-update path inglobal/global.tsfor hot reloads from the editor.Schema
main.customFontUrl?: stringadded toBrandingConfigurationinsaasquatch.d.ts. Backward-compatible — existing configs without the field still take the Google Fonts path.CSS variable
--sqm-primary-fontcontinues to read frombrandFont(the family name). Because the synthesized@font-faceregisters under that same name, no changes are needed instyles.ts's:rootblock.How Has This Been Tested?
<link id="brandFontStylesheet">is injected; switch to a custom URL/upload, confirm<style id="brandFontStylesheet">with the right@font-facereplaces it..woff2,.ttf,.otf.Checklist:
🤖 Generated with Claude Code