Heroku and Google Fonts

前端 未结 6 1764
南笙
南笙 2020-12-31 02:06

Why doesn\'t embedding google fonts work on Heroku?

For example:

\' rel         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-12-31 03:04

    I discovered that heroku sets security parameters for using the google fonts url. It wants to use the https instead of plain http. Here's what worked for me.

    Instead of:

    @import url('http://fonts.googleapis.com/css?family=Oswald:400,700,300');
    

    I used

    @import url('//fonts.googleapis.com/css?family=Oswald:400,700,300');
    

    If you notice the second line leaves out the http, allowing heroku to use https. I'm assuming you could probably use https in the link if you wanted to.

提交回复
热议问题