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

Improve font loading #283

Closed
cindyli opened this issue Jun 12, 2020 · 1 comment
Closed

Improve font loading #283

cindyli opened this issue Jun 12, 2020 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@cindyli
Copy link
Contributor

cindyli commented Jun 12, 2020

Is your feature request related to a problem? Please describe.

Right now, the website is using "font-display: optional" with preloading all font files to gain the best user experience but sacrificing the performance. See the performance test result with preloading all font files.

A common recommended way for font loading is to use "font-display: swap" that doesn't provide the best user experience but has better performance.

@greatislander also found a different method that loads font files in two phases to improve the user experience without sacrificing the performance.

It would be worthwhile to run tests against these three scenarios:

  1. Using swap;
  2. Using optional + preload;
  3. Loading fonts in two phases.

To compare their implementation complexity, effects on loading time at slow connection, and lighthouse reports.

The result will benefit all website developments in overall.

@cindyli cindyli added the enhancement New feature or request label Jun 12, 2020
@cindyli cindyli added this to the 2.2.0 milestone Jun 12, 2020
@cindyli
Copy link
Contributor Author

cindyli commented Jun 15, 2020

The conclusion in short, this solution doesn’t seem helpful for the WeCount site.

The reason: the .woff and .woff2 files used by WeCount site are already fairly small. Each first stage font file generated by running pfftsubset, suggested in the article, is only 5-7K smaller than ones that are already used on the WeCount site.

Using the regular Fira Sans font file as an example, all sizes are:

  • .woff2 that is used on WeCount site: 21K
  • .woff2 generated for the first stage loading: 14K
  • .woff2 generated for the 2nd stage loading: 128K

I believe the 2nd stage file suggested by the article is much larger is because it includes all layout features. Some of them may not be included at generating the WeCount file.

So, for now, I will take the other suggestion to load font files using “swap”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant