【发布时间】:2015-05-03 17:44:38
【问题描述】:
问题:
在看到有关此主题的问题后,我请求您的帮助。
/assets/stylesheets/styles.css:
@import url("http://fonts.googleapis.com/css?family=Merriweather");
当我在 test 或 development 上运行 rails s 时,会加载字体“Merriweather”,但是当我在 production 上运行服务器时,字体没有加载,但是styles.css被加载了。
我尝试过的:
• 将@import url(...) 放入application.css 或welcome.scss 或bootstrap.css.scss
• 将@import url('http://fonts.google...') 更改为@import url('//fonts.google...')
附加信息:
应用程序.css
*= require_tree .
*= require_self
*= require 'styles'
Github: https://github.com/David-Amrani-Hernandez/MovieReader
【问题讨论】:
-
您的网站在
https协议上运行? -
@NomanUrRehman 不,正在 http 上运行。我正在使用 Thin,我从 Rails 开始。
-
尝试在您的项目根目录下运行此命令,然后检查它是否有效。我认为你没有预编译你的资产
rake assets:precompile -
它不起作用。问题不在于未加载styles.css。问题是加载了styles.css,但没有导入字体。 @NomanUrRehman
标签: css ruby-on-rails fonts import ruby-on-rails-4.2