-
Notifications
You must be signed in to change notification settings - Fork 1
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
Spike: Explore better font compilation #149
Comments
After doing some research and reaching out to @ethangardner, below are my findings on ways to deal with the flash of unstyled font and which option I chose. Articles and ResourcesBest practices for fonts Methods to Handle Flash of Unstyled Fonts (FOUF) for Self-Hosted FontsMethod 1 - Using only HTML and CSS
At the end of your last .css file, add:
Method 2: Font Face Observer
Example:Javascript:
CSS:
Method 3: CSS Font Loading API
Example:Javascript:
Method 4: FOUT with a Class (FOUC)
Example:HTML:
CSS:
Javascript:
Method 5: Font Display Property
Example:CSS:
Method 6: Preloading Fonts
Example:HTML:
Method 7: Critical CSS and Inlining
Example:HTML:
ConclusionEach of the methods listed above can be effective, but I chose to use method 1 due to its simplicity and lack of reliance on JavaScript or APIs. Additionally, it avoids overloading browser resources, a risk associated with excessive preloading, and it doesn't require overriding the USWDS font-face styles. Should method 1 prove inadequate in the future, there are six alternative methods available for testing. |
Reach out to @ethangardner and discuss other ways to include Poppins to avoid the flash of unstyled font (FOUF)
The text was updated successfully, but these errors were encountered: