Should I locally store CSS generated by the Google Web Fonts API?

自古美人都是妖i 提交于 2019-12-03 10:12:43

The CSS served up by Google Webfonts changes depending on the user agent in the HTTP request header, so you'd be better off using @import. The reason is the different implementations of web fonts in different browsers.

Not an answer to your exact question, but even if it were possible at the moment, I would never locally cache any CSS that Google serves "live" because:

  • even if it works now, it may break later if they change something

  • you do not add any reliability, because the font itself still has to be fetched from Google

  • you do not really improve performance much: if everything is configured correctly, the HTTP request will happen only once and be cached thereafter. Also, the user may have the font CSS cached from another site that uses Google Fonts.

If you want to store local CSS then you MUST store font locally too because otherwise it will again have an extra HTTP request.

And Google allows downloading font for local usage but you can check for web too. https://developers.google.com/webfonts/faq

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!