Repository navigation
feat(cli): warn when a theme names fonts it does not load - #5045
Merged
Merged
Conversation
`astryx theme build` now checks the resolved --font-family-* tokens and component-override fontFamily values against CSS generics and known preinstalled system families (including the shipped themes' deliberate fallback stacks, so none of the seven themes false-warns). Anything else gets one warning per family in the receipt and on stderr, plus the <link>/@font-face snippet printed after the install instructions — the slot that previously held a dead resolvedTheme.fonts block (meta#2226 removed the field it read). `astryx docs typography` gains a Loading Custom Fonts section (Google Fonts and self-hosted recipes, font-display: swap, real fallback stacks); the theme docs' production-build section points at it. Shipped webfont themes now warn by design in repo builds — the same builds already print install instructions for them. Part (3) of the issue (the phantom url field in the docs) is a design call and is left untouched. Closes meta#5015
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Nine tests: null/non-string resolved-theme inputs, fontFamily nested under pseudo-class override blocks (unit and through the defineTheme path), var() fallbacks containing another var(), case-variant generic keywords, css2 URL percent-encoding, and the --json envelope contract (warnings in the receipt, snippet suppressed, stdout stays parseable). The multi-line test caught a real bug: the quoted-name check lacked dotAll, so a family quoted across lines (template-literal theme sources) kept its quote characters, breaking dedupe, system-font matching, and the css2 URL. Fixed with the /s flag.
AKnassa
marked this pull request as ready for review
August 15, 2026 03:06
AKnassa
requested review from
cixzhang,
imdreamrunner and
josephfarina
as code owners
August 15, 2026 03:06
cixzhang
approved these changes
Aug 15, 2026
cixzhang
left a comment
Contributor
There was a problem hiding this comment.
Oh thank you for getting this!
cixzhang
enabled auto-merge (squash)
August 15, 2026 23:47
This was referenced Aug 16, 2026
This branch was successfully deployed
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.
Closes #5015
Heads up @cixzhang: saw you self-assigned this shortly after filing, so this may cross work you already have in flight. No hard feelings at all if you'd rather land your own version; happy to close this one or rebase onto yours. Sharing since it was ready.
What this does
astryx theme buildnow tells a theme author when their theme names a font that nothing actually loads, and prints the exact<link>and@font-facesnippet to add. The docs also gain the loading recipe the disclaimers always pointed at.Why
A theme can name any webfont, the build succeeds, the CSS is correct, and the browser quietly falls back on every clean machine. Nothing in the pipeline said so. This covers parts (1) and (2) of the issue; part (3), the
urlfield question, is a design call and is left untouched here.What changed
theme build: resolved--font-family-*tokens and component-levelfontFamilyvalues are compared against CSS generics and known preinstalled system families (including the shipped themes' deliberate fallback stacks, so none of the seven themes false-warns). Anything unrecognized is treated as a webfont.--jsonsees it) and stderr; the copy-pasteable fix prints after the install instructions, in the slot that held the deadresolvedTheme.fontsblock from before feat(theme): remove runtime font loading from defineTheme #2226.astryx docs typographygains a "Loading Custom Fonts" section (Google Fonts and self-hosted recipes,font-display: swap, real fallback stacks); the theme docs' production-build section points at it.Expected side effect: repo builds of the shipped webfont themes (neutral, butter, chocolate, gothic, matcha, stone, y2k) now print this warning by design, the same way those builds already print install instructions for them.
How to see it
Build any theme that names a webfont:
A theme that only names system fonts prints nothing new.
astryx docs typographyshows the new "Loading Custom Fonts" section.Round 2: edge-case tests
Nine new tests: null and non-string resolved-theme inputs, fontFamily nested under pseudo-class override blocks (unit and through the real defineTheme path), var() fallbacks containing another var(), case-variant generic keywords, multi-line quoted family names, css2 URL percent-encoding, and the --json envelope contract (warnings in the receipt, snippet suppressed, stdout stays parseable).
The multi-line test caught a real tokenizer bug: the quoted-name check lacked dotAll, so a family quoted across lines kept its quote characters, breaking dedupe, system-font matching, and the css2 URL. Fixed with the /s flag.