How do I use google fonts on my site without compromising the page speed of the site

前端 未结 2 1252
滥情空心
滥情空心 2021-02-04 01:23

I use Google fonts and my site\'s typography. Looks great but it adds a great overhead. Is there a way I can still get the same look and feel for my website without compromisin

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-04 02:08

    Yes you can.

    1. download your google web font files
    2. upload them to font squirrel web generator
    3. select Expert settings and tick: Base64 CSS.
    4. when loading the font through base64, you are not waiting for an external http call to finish.
    5. this will remove the Flash Of Unstyled Content (FOUC)

    Reference: https://robert.accettura.com/blog/2009/07/03/optimizing-font-face-for-performance/ and you can look up online many other articles. I've also tried it on my website, and it works.

提交回复
热议问题