繁体   English   中英

Font-Awesome-Rails无法加载图标

[英]Font-Awesome-Rails Not Loading Icons

我的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的硬拷贝,这是造成此问题的原因。 我删除了该宝石,宝石按预期工作!

那是一个错误

尝试使用

@import "font-awesome.css";

代替

@import "font-awesome";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM