Heroku和Google字体 [英] Heroku and Google Fonts

查看:130
本文介绍了Heroku和Google字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么不在Heroku中嵌入谷歌字体?



例如:

 < link href ='http://fonts.googleapis.com/css?family =< some_kinda_font>'rel ='stylesheet'type ='text / css'>编辑:事实证明,它的作品,我的铬扩展之一是阻止它作为一个不安全的脚本 

解决方案

我发现,heroku设置使用google字体url的安全参数。它想要使用https而不是普通的http。

而不是:

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

我使用了

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

如果您注意到第二行遗漏了http,允许heroku使用https。我假设你可以在链接中使用https,如果你想。

Why doesn't embedding google fonts work on Heroku?

For example:

<link href='http://fonts.googleapis.com/css?family=<some_kinda_font>' rel='stylesheet' type='text/css'>

EDIT: turns out it works, one of my chrome extensions was blocking it as an "insecure script"

解决方案

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.

这篇关于Heroku和Google字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆