css - Font-Awesome-Rails 未加载图标

标签 css ruby-on-rails ruby twitter-bootstrap font-awesome

我的 Gemfile 中有这个:

gem 'rails', '4.1.0'
gem "therubyracer"
gem 'jquery-rails'
gem 'bootstrap-sass'
gem 'sass-rails', '4.0.2'
gem 'autoprefixer-rails'
gem 'simple_form', '~> 3.1.0.rc1'
gem 'devise'
gem 'geocoder'
gem 'paperclip', '~> 4.1'
gem 'font-awesome-rails'

我已将其包含在 app/assets/stylesheets/application.css.scss

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 */
@import "font-awesome";
@import "bootstrap-sprockets";
@import "bootstrap";

然后我把这个放在我的观点中:

          <%= fa_icon "camera-retro" %>

在我的浏览器中,我可以看到这样呈现的 HTML:

<i class="fa fa-camera-retro"></i>

但是,没有图标显示。

我还可以看到 font-awesome.css 正在加载:

enter image description here

当我这样做时:

          <%= fa_icon "camera-retro", text: "hello there camera" %>

我得到:

enter image description here

这是我向助手添加文本:

我确定我错过了什么,但是什么?

最佳答案

我的 app/assets/stylesheets 目录中有一份 font-awesome.css 的硬拷贝,它导致了这个问题。我删除了它, gem 按预期工作了!

关于css - Font-Awesome-Rails 未加载图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24961283/

相关文章:

css - 基于用户代理加载不同的 .css - GWT 元素

sql - Rails 分页 - 从实例 ID 中查找页码

ruby-on-rails - 自记录 REST 接口(interface)

ruby-on-rails - .where(nil) 和 .all 有什么区别?

html - 垂直对齐图像对象旁边的链接

javascript - 对样式化组件使用自定义文档时未传递 Prop

ruby-on-rails - Ruby 字符串转数组方法

ruby - 在 Ruby 脚本中运行命令行命令

html - 垂直 DIV 液体布局问题

ruby-on-rails - Delayed_Jobs 不会刷新