我的 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 正在加载:
当我这样做时:
<%= fa_icon "camera-retro", text: "hello there camera" %>
我得到:
这是我向助手添加文本:
我确定我错过了什么,但是什么?
最佳答案
我的 app/assets/stylesheets 目录中有一份 font-awesome.css 的硬拷贝,它导致了这个问题。我删除了它, gem 按预期工作了!
关于css - Font-Awesome-Rails 未加载图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24961283/