字体真棒没有加载图标 - Rails 4

Ish*_*pta 4 css ruby twitter-bootstrap font-awesome ruby-on-rails-4

我在我的应用程序中使用twitter bootstrap,因为我使用ruby gem twitter-bootstrap-rails (2.2.8).我已将导轨版本升级为导轨4.

我正在使用以下宝石作为资产

gem 'less-rails'
gem 'coffee-rails'
gem 'twitter-bootstrap-rails'
gem 'execjs'
gem 'therubyracer', :platforms => :ruby
Run Code Online (Sandbox Code Playgroud)

现在问题是没有加载字体awesome的图标.它应该根据我的HTML加载放大镜玻璃<button type="submit" class="btn"><i class="icon-search"></i></button>

在此输入图像描述

这是我的bootstrap_and_overrides.css.less

@import "twitter/bootstrap/bootstrap";
@import "twitter/bootstrap/responsive";

// Set the correct sprite paths
@iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings");
@iconWhiteSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings-white");

// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
// Note: If you use asset_path() here, your compiled bootstrap_and_overrides.css will not
//       have the proper paths. So for now we use the absolute path.
@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
@fontAwesomeEotPath_iefix: asset-path("fontawesome-webfont.eot#iefix");
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");

// Font Awesome
@import "fontawesome/font-awesome";

// Glyphicons
//@import "twitter/bootstrap/sprites.less";
Run Code Online (Sandbox Code Playgroud)

Ish*_*pta 9

仍然不确定问题是什么,但我已经包括gem "font-awesome-rails"在我Gemfile*= require font-awesome我的application.css,之后一切正常.

  • @captainrad - 这是对Rails资产管道的指令,它位于`application.css`文件头部的注释块中 (3认同)