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

3.19 - Preload Fonts - Beacon processing Pilot - Parse stylesheets and extract font properties #7306

Open
jeawhanlee opened this issue Feb 14, 2025 · 2 comments
Labels
priority: low Issues that can wait
Milestone

Comments

@jeawhanlee
Copy link
Contributor

It has been observed that when loading external fonts on chrome, the font url is not exposed with the Performance API, This has lead us to consider various options to bypass this.

  • Fetch the stylesheet via JS and parse it to extract all the font rules
  • Print font CSS on page to expose font urls
  • Fetch the stylesheet via PHP and parse it to extract all the font rules then send this to the beacon.

However, the first 2 options are not without cons for the first, we'll need to consider another overhead don by fetch API to get the CSS and also CORS issue. The Second might lead to increased page size in terms of large font stylesheet or several font styles used on a page.

We settled for the third because we'll parse the stylesheet in a single request without creating an overhead and having to print it to the page, Then match all the font properties just like it was done here and pass the return value containing an array of fonts and their properties as a custom data to the beacon script to process.

@jeawhanlee
Copy link
Contributor Author

jeawhanlee commented Feb 19, 2025

We'll not need this part during pre-alpha, we can improvise with a mock data.
Moving back to Todo to be picked up after pre-alpha.

@jeawhanlee jeawhanlee removed their assignment Feb 19, 2025
@MathieuLamiot
Copy link
Contributor

Challenging the choice between the 3 approaches here: https://wp-media.slack.com/archives/CUT7FLHF1/p1739993152828119

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low Issues that can wait
Projects
None yet
Development

No branches or pull requests

2 participants