Repository navigation
Conversation
A family loads with a dynamic import of its CSS module, so the client build gives its files hashed names the server could not know, and a design's fonts arrived only once the page's script asked: text drew in a fallback face and swapped after hydration. A build plugin now records each font module's stylesheet and Latin woff2 files from the client build, by the font id the loader gives it, and hands them to the server build as a virtual module. The design view carries the links: each family's stylesheet and at most two preloads, the body at 400 and the headings at their weight or the nearest the family has. Inter ships with the app's own stylesheet and needs neither. Three admin pages' script ceilings take their readings: main already reads about 2% over them, and these bytes leave them under 0.1 KB from the limit.
Importing the type from the build plugin gave server code a dependency on lib/build, which the dependency graph does not allow for.
Member
Author
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.
The twenty-third of the stack that builds a new design engine for the portal, and the fourth of phase 5. A portal page now links its design's fonts in the head during SSR, so text draws in its face from the first paint instead of swapping in after the page's script asks for it. Behind the
portalDesignV2flag.How
lib/build/font-manifest.tsis a Vite plugin. A family loads with a dynamicimport()of its CSS module, so the client build gives its stylesheet and files hashed names. The plugin records, by font id, each module's stylesheet and its Latinwoff2files by weight, and hands them to the server build asvirtual:quackback-font-manifest. The client is built first, as for the router's own manifest. It reads which module serves which id fromfont-loader.tsitself, so there is no second list to keep in step. In the dev server and tests the manifest is empty and fonts load as before.fontLinks()(domains/design/font-plan.ts) gives each bundled family's stylesheet and preloads at most two Latin files: the body at 400 and the headings at their weight, or the nearest weight the family has. Inter ships with the app's own stylesheet and needs neither.portalDesignView()adds them to the design view asfontLinks, so the browser's code only reads them, and the portal'shead()appends them to its links.Verification
woff2and linked the stylesheets. The browser fetched each file once, from the head, the stylesheets came from the head rather than a script, and no preload went unused.woff2files, notlatin-ext, italic orwoff; the links preload the body at 400 and the headings at their weight or the nearest one, once for one family at one weight, and nothing for Inter; the design view carries them; legacy carries none.