Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to minimize the delay in loading the Font Awesome icons?

I have linked the minified CSS of Font Awesome from Bootstrap CDN in a webpage. The problem is that the icons appear later than the rest of the page content after a visible delay.

What is the best way to get rid of this delay? (FYI, I have already included this CSS file above every other CSS and JS link in the head.)

like image 721
Price Avatar asked Dec 05 '15 17:12

Price


People also ask

How do I speed up Font Awesome?

Using a CDN not only decreases load time of Font Awesome but also increases the likelihood of a user already having the Font cached on their computer even if they haven't visited the our site - if they've visited another site which uses the same CDN then Font Awesome should be on their computer already.

Why is Font Awesome not loading?

Make sure you're using the latest and greatest by updating your CDN code reference, updating your Font Awesome package via npm, or downloading a fresh copy of Font Awesome. You can check with version an icon was added to on its detail page (e.g. question-circle was added in Verion 1 but last updated in 5.0. 0).

Can I use Font Awesome icons offline?

Go to font awesome official website and download free zip file, extract it and link this to your page, done..!

What is FAS and fab in Font Awesome?

fas: font awesome solid. It is also free to use. fab: font awesome brands. Free to use.


1 Answers

The minified css would not make much of a difference in load time. That font awesome css file references the paths to external font files that will load in after the page loads. You can see the delay on font awesome's website: https://fortawesome.github.io/Font-Awesome/icons/

@font-face {
  font-family: 'FontAwesome';
  src: url('../fonts/fontawesome-webfont.eot?v=4.5.0');
  src: url('../fonts/fontawesome-webfont.eot?#iefix&v=4.5.0') format('embedded-opentype'), url('../fonts/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), url('../fonts/fontawesome-webfont.woff?v=4.5.0') format('woff'), url('../fonts/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), url('../fonts/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg');
  font-weight: normal;
  font-style: normal;
}

You could base64 encode the fonts and include them right in your site's css. This would substantially increase your site's css load time, but it would get rid of the flash. Although it might not work in all browsers and I would not recommend it.

You could try hosting the font awesome css and fonts directly on your server. The CDN might be the cause of the latency.

like image 52
Fraser Crosbie Avatar answered Sep 18 '22 16:09

Fraser Crosbie