-
Notifications
You must be signed in to change notification settings - Fork 130
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
Preload and self-host web fonts based on custom styles #423
Comments
`bundleStyles` correctly puts the `@import "url";` lines at the top of its text. In the preview or build scripts, we can easily detect these lines with RegExp and maybe remove them from the bundled CSS—though that is not even strictly necessary. Hoisting them as stand-alone links is what will give the performance boost, and it's a bit more difficult, because in both cases (preview and render) we bundle much later than we link, so it looks like we have to change the order of operations. I think it's doable but I'm not fully there yet.
We likely want to introduce a <link rel="stylesheet" href="google-fonts:/css2?family=Source+Serif+Pro:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap"> But this is hotlinked: <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Serif+Pro:ital,wght@0,400;0,600;0,700;1,400;1,600;1,700&display=swap"> |
Does this need to be tied to the vendor? Or can we imagine calling this e.g. or if we want shorthand:
|
#414 adds support for custom styles,
but we still hard-code the use of Google Fonts. We shouldinsteadtransform the CSS bundle somehow to flatten external imports so that preloading is accurate.The text was updated successfully, but these errors were encountered: