-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom fonts with preloading #209
base: main
Are you sure you want to change the base?
Conversation
Part of #87. # To do - [ ] add docs (assets/fonts/README.md?) - [ ] use swap with Fontaine?
Deploying head-start with Cloudflare Pages
|
}, | ||
]; | ||
|
||
export const getFontCss = (font: Font) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: import raw (import archivo400css from '@fontsource/archivo/latin-400.css?raw';
) is not an option as it results in font urls starting with ./files/...
that are not resolved. So instead we generate the font declaration ourselves with the url that is resolved correctly in production.
Note 2: I've left out font-display: swap;
as we don't have a fallback yet that doesn't cause a layout shift. See to do on Fontaine and font swap.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fontaine seems a bit involved. Rather keep this PR small and merge this first, to add font swap as perf enhancement in a separate PR.
@@ -1,7 +1,22 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add tests for this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That also triggers the question if the fonts
and preConnectOrigins
should be passed as props?
Changes
Note: based on #208 so the
<PerfHead>
could easily be extended.Associated issue
Resolves #87
How to test
Checklist
I have made updated relevant documentation files (in project README, docs/, etc)created follow-up issue Document assets setup #210I have added a decision log entry if the change affects the architecture or changes a significant technology