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

set font-display property #6

Merged

Conversation

superruuuun
Copy link
Contributor

@superruuuun superruuuun commented Mar 12, 2021

I set font-display: block; into feathericon's @font-face.

Background

I found that feathericon-sass's file loading is costing time a little.
Google introduces the way to shorten font loading time by setting font-display property into @font-face,
so I suggest to introduce this solution into feathericon.

Here is the reference about it.
How to avoid showing invisible text | google web.dev

Supplement

The documentation above introduces font-display: swap; as a solution for text font, by displaying alternative font during loading.
However, in the case of icon font, which has no alternative font, font-display: block; is the optimal solution. It displays blanc object during loading.
Reference: font-display #the_font_display_timeline | MDN

For your refference, other open source icon font FontAwesome adopts font-display: block; , too.
https://github.com/FortAwesome/Font-Awesome/blob/fcec2d1b01ff069ac10500ac42e4478d20d21f4c/css/all.css#L4590

@shoken0x
Copy link
Member

@superruuuun LGTM!Thanks.
If you like, you will backport it to feathericon/feathericon 😀

@shoken0x shoken0x merged commit dc305b2 into feathericon:master Mar 13, 2021
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.

2 participants