Dav*_*ani 1 css import fonts ruby-on-rails ruby-on-rails-4.2
看到有关此主题的问题后,我请求您的帮助。
/assets/stylesheets/styles.css:
@import url("http://fonts.googleapis.com/css?family=Merriweather");
当我rails s在test或development上运行时,加载了字体“Merriweather”,但是当我在生产上运行服务器时,没有加载字体,但加载了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'
Run Code Online (Sandbox Code Playgroud)
Github:https : //github.com/David-Amrani-Hernandez/MovieReader
Have you tried linking directly to the font source in the <head> of your application layout file rather than via a stylesheet?
application.html.erb
<head>
...
<%= stylesheet_link_tag( 'http://fonts.googleapis.com/css?family=Merriweather' ) %>
...
</head>
Run Code Online (Sandbox Code Playgroud)
I have used this method in production several times, and it hasn't given me problems. I hope it is the same for you.
| 归档时间: |
|
| 查看次数: |
611 次 |
| 最近记录: |