Skip to content
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

Automatic font preload links in the head #600

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

royduin
Copy link
Member

@royduin royduin commented Oct 17, 2024

The package just grabs all the woff2 fonts discovered by Vite and generates preload links for them:

<link rel='preload' href='https://website.com/build/assets/font.woff2' as='font' type='font/woff2' crossorigin>

@royduin royduin requested a review from indykoning as a code owner October 17, 2024 16:12
@royduin
Copy link
Member Author

royduin commented Oct 17, 2024

Doesn't seem to play nice with Statamic's static caching when used in combination with https://github.com/rapidez/statamic

@royduin
Copy link
Member Author

royduin commented Oct 18, 2024

So the issue was Nginx in combination with https://github.com/justbetter/laravel-http3earlyhints, it had nothing to do with the Statamic integration:

upstream sent too big header while reading response header from upstream

But that's because in the specific project there are 28 fonts within the manifest and the size limit is not inline with the Nginx defaults: https://github.com/justbetter/laravel-http3earlyhints/blob/1fc4c118ab792f5bf5ab3ec81eb27625857a38ba/src/config.php#L13

When you've a multisite like: https://docs.rapidez.io/3.x/theming.html#multistore, all fonts are in the manifest. So the fonts of all your website are added as a preload.

Should we split and have a manifest per website? Or should we check the generated CSS file if the fonts are actually in the specific CSS file?

@royduin
Copy link
Member Author

royduin commented Oct 18, 2024

@royduin royduin marked this pull request as draft December 5, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant