Font-Awesome-Rails没有加载图标

时间:2014-07-25 17:27:41

标签: 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

我在这里向帮助者添加了文字:

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

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:2)

这是bug

尝试使用

@import "font-awesome.css";

而不是

@import "font-awesome";