Skip to content

set font-display property#6

Merged
shoken0x merged 1 commit intofeathericon:masterfrom
superruuuun:feature/set_font-display_attribute
Mar 13, 2021
Merged

set font-display property#6
shoken0x merged 1 commit intofeathericon:masterfrom
superruuuun:feature/set_font-display_attribute

Conversation

@superruuuun
Copy link
Copy Markdown
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
Copy Markdown
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