简体   繁体   English

除非我链接到外部网址,否则Google字体无法在Rails中工作

[英]google font does not work in rails unless i link to external url

I have saved the google font at the url 我已将Google字体保存在网址中

https://fonts.googleapis.com/css?family=Montserrat:400,700%7cDroid+Serif:400,700,400italic,700italic%7cRoboto+Slab:400,100,300,700

to

app-->assets-->stylesheets-->external-->contemporary_fonts.css.scss

Here is my application.css: 这是我的application.css:

*= require_tree ./font-awesome
*= require_tree ./external
*= require_tree ./production
*= require_self
*= require custom
*/

The css file loads. css文件加载。 I check the page source and the stylesheet is there. 我检查页面源代码和样式表。 For some reason though, the fonts are not showing up. 但是由于某种原因,字体没有显示出来。 If i just include a "link href" to the url, it will work, but i don't want to do that. 如果我仅在网址中包含“ link href”,它将起作用,但我不想这样做。 I want all of the stylesheets to be hosted on the rails app. 我希望所有样式表都托管在rails应用程序上。

Why is the font not working? 为什么字体不起作用?

尝试在contemporary_fonts.css.scss执行@import

@import https://fonts.googleapis.com/css?family=Montserrat:400,700%7cDroid+Serif:400,700,400italic,700italic%7cRoboto+Slab:400,100,300,700

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM