-
Notifications
You must be signed in to change notification settings - Fork 12.2k
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
Lighthouse Issue with Font Performance for font-display #14387
Comments
Hi! Thanks for being part of the Font Awesome Community. Interesting! Have you an 1-vs-1 comparison? Do you know if there are any breaking changes in including this property on the supported browsers? |
@tagliala There's no side effects for supported browsers - the declaration is ignored and FA behaves like it wasn't ever set. |
+1 |
Thanks for the heads-up @robmadole could you please take a look? |
This is also something I would be interested in as well. It should be a simple fix in the _path.scss file(in version 4.7. Not sure about the current version)
You would just add font-display below the font family line |
Isn't Also, just because it is one css it doesn't mean that it is a simple fix 😅 It should always be tested against all browsers supported by Font Awesome and prepare for something we didn't think about |
Definitely not block, swap is recommended as the best performing option. Check out this guides: |
Here is a cool demo of the differences between the various options: |
what would be a system replacement for Font Awesome? Any local installed version? 🤔 |
https://css-tricks.com/snippets/css/using-font-face/#article-header-id-17 |
@tagliala I'm aware of development processes and was not suggesting that you should deploy a 1 line CSS fix without doing your due diligence of testing across all browsers, etc. Hence why I said It |
I agree with @tagliala. At this point, it should be |
Would it be possible to make this a setting in _variables.scss? |
I'm going to add it to |
@robmadole so does it mean that you will implement variable in the nearest release version? |
Thank you all! |
Thank you, @robmadole and @tagliala |
@tagliala Can it be |
This is my site https://www.fileour.com/ I will try to fix the font problem. But it not works fine. I am very sad. |
You cannot mark it swap by default - this will cause random characters to appear (or in the best case squares). This is a very bad UX.
See the explanation from Google:
swap gives the font face a zero second block period and an infinite swap period. This means the browser draws text immediately with a fallback if the font face isn’t loaded, but swaps the font face in as soon as it loads.
This behavior is desired for small blocks of text (e.g. headings). For big chunks of texts you should use fallback for big blocks (e.g. article contents). The block setting gives the user no icons on load and loads them as soon as possible, which is better than broken icons blinking into proper icons.
… On Mar 20, 2019, at 9:03 PM, Tran Ngoc Tuan Anh ***@***.***> wrote:
@tagliala Can it be swap by default? We use FontAwesome CDN and can't change it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thank you. I will try this. |
@kiler129 Thanks! That's very helpful. |
@garygreen: That's neat. But, for me, using this approach does load the file, but the font is not displayed. |
i have same issue in my site https://www.rosemusics.com |
Hi @rosemusic, the best option for icon fonts is the If you are interested in improving your website's performance, my advise is to use svg files directly or to use a custom version of the SVG framework (webpack/rollup with tree shaking) with async loading of the javascript asset Ref: |
thanks so much. |
hi, I'm having the same OP issue with lighthouse and I don't know how to solve it. I don't host fonts nor scripts locally anymore because it's a small static site hosted on gitlab pages and it had massive performance issues when I did. hence my switch to cdn for FA (cdnjs), gfonts, jquery and leaflet maps. I see that this issue has been resolved and closed but I cannot find a way to use &display=swap in the cdn url as google fonts offer. is that possible with FA/cdnjs? how? any advice would be highly appreciated. thanks |
@gacallea you don't want to use |
@robmadole thanks for your quick reply. how do I do that? is it the default? |
It's the default. But Lighthouse is going to ding you for it. I don't think there is anything that can be done about that. |
I filed GoogleChrome/lighthouse#10127 for that. |
👋 Lighthouse maintainer here, Lighthouse will not ding you for using The intention of that audit is to explicitly opt-in or opt-out of font blocking, not to force icon fonts to render gibberish characters; no one wants that :) |
@tagliala Please re-open :) |
@Stanzilla thanks for the heads-up, I've missed @patrickhlauke 's comment (sorry!) Perfect, we can set About FA 4's CDN link, it is in EOL, and it is not hosted by us /cc @robmadole |
Sorry, I'm going to close this in favour of #16077 |
Currently, if you try to use a Lighthouse tool in the Chrome you would find that "Text is invisible while web fonts are loading" in which we need to "Leverage the font-display CSS feature to ensure text is user-visible"
In this case, it means that
@font-face
should load withfont-display
property. In case of the icons, it should be load infont-display: block
which helps the font face a short block period.In the main time, I am using font awesome as a package which I am importing it to the project via SCSS.
Is this something that can be added to the
@font-face
?Reference:
The text was updated successfully, but these errors were encountered: