字体真棒和图像不加载在ruby-on-rails-4生产firefox [英] font-awesome and images is not loaded in ruby-on-rails-4 production firefox

查看:134
本文介绍了字体真棒和图像不加载在ruby-on-rails-4生产firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在ruby-on-rails-4中使用font-awesome,而在我的开发模式下,chrome和firefox都可以正常工作
。但我无法找出什么原因,字体真棒和图像没有加载到生产模式,其中font-awesome在铬合金工作正常。

解决方案

试试这在字体真棒在轨4:



https://coderwall.com/p/1uqvkq



希望这会有帮助。




如果上面的一个不适合你,请试试这个。
优先:向资产路径(config / application.rb)添加 app / assets / fonts

  config.assets.paths<< Rails.root.join(app,assets,fonts)

然后移动字体文件放入/ assets / fonts(首先创建文件夹)

现在将font-awesome.css重命名为font-awesome.css.scss.erb并将其编辑为这个:改变:

pre $ @ font-face {
font-family:FontAwesome;
src:url('../ font / fontawesome-webfont.eot'); (''/ font / fontawesome-webfont.eot?#iefix')格式('eot'),url('../ font / fontawesome-webfont.woff')格式('woff (''/ font / fontawesome-webfont.svg#FontAwesome')格式('svg');
font-weight:normal;
font-style:normal;



$ b $ p




  @ font-face {
font-family:FontAwesome;
src:url('<%= asset_path(fontawesome-webfont.eot)%>'); $('eot'),url('<%= asset_path('格式('woff'),url('<%= asset_path(fontawesome-webfont.ttf)%>')格式('truetype'),url ('<%= asset_path(fontawesome-webfont.svg)+#FontAwesome%>')format('svg');
font-weight:normal;
font-style:normal;

code


让我们试试这个。

I am using font-awesome in ruby-on-rails-4 and in my development mode everything works fine in both chrome and firefox. But i am not able to find out what is the reason that font-awesome and images is not loaded into production mode, where font-awesome is works fine in chrome.

解决方案

Try this for font-awesome in rails 4:

https://coderwall.com/p/1uqvkq

Hope it will help.

Or Try this if above one not working for you. first: add app/assets/fonts to the asset path (config/application.rb)

config.assets.paths << Rails.root.join("app", "assets", "fonts")

then move the font files into /assets/fonts (create the folder first)

Now rename the font-awesome.css to font-awesome.css.scss.erb and edit it like this: change:

@font-face {
  font-family: "FontAwesome";
  src: url('../font/fontawesome-webfont.eot');
  src: url('../font/fontawesome-webfont.eot?#iefix') format('eot'), url('../font/fontawesome-webfont.woff') format('woff'), url('../font/fontawesome-webfont.ttf') format('truetype'), url('../font/fontawesome-webfont.svg#FontAwesome')    format('svg');
  font-weight: normal;
  font-style: normal;
}

to this:

@font-face {
  font-family: "FontAwesome";
  src: url('<%= asset_path("fontawesome-webfont.eot") %>');
  src: url('<%= asset_path("fontawesome-webfont.eot") + "?#iefix" %>') format('eot'), url('<%= asset_path("fontawesome-webfont.woff") %>') format('woff'), url('<%= asset_path("fontawesome-webfont.ttf") %>') format('truetype'), url('<%= asset_path("fontawesome-webfont.svg") + "#FontAwesome" %>') format('svg');
  font-weight: normal;
  font-style: normal;
}

Lets try this.

这篇关于字体真棒和图像不加载在ruby-on-rails-4生产firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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