我在 rails 3.2.13 应用程序中使用 Font Awesome。我已成功将以下图标添加到应用程序中:icon-search icon-shopping-cart 等。但是由于某种原因,当我尝试使用 icon-thumbs-up 和 icon-thumbs-down 时,它们看起来像 icon-thumbs-up-alt 或 icon-thumbs-up-alt。如果我尝试使用 icon-thumbs-up-alt,页面上不会显示任何图标。
我通过 gems 访问 bootstrap 和 font awesome:
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'therubyracer'
gem 'font-awesome-rails'
gem 'jquery-ui-rails'
gem 'less-rails'
gem 'twitter-bootstrap-rails'
gem 'uglifier', '>= 1.0.3'
end
这是 application.css.scss 文件:
*= require bootstrap_and_overrides
*= require_self
*= require_tree .
@import "font-awesome";
.icon-thumbs-up {
color: green;
}
.icon-thumbs-down {
color: red;
}
这是 bootstrap_and_overrides.css.less
@import "twitter/bootstrap/bootstrap";
body { padding-top: 50px; }
@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 boostrap_and_overrides.css will not
// have the proper paths. So for now we use the absolute path.
@fontAwesomeEotPath: asset-path("fontawesome-webfont.eot");
@fontAwesomeWoffPath: asset-path("fontawesome-webfont.woff");
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
// Font Awesome
@import "fontawesome";
这是使用图标的按钮:
<%= link_to (content_tag(:i, "", :class=>"icon-thumbs-up")) + (content_tag(:i, "", :class=>"icon-thumbs-down")) + " Review", root_path , :class => "btn" %>
因为我添加了 twitter-bootstrap-rails 和 font-awesome-rails gems,所以问题可能是冲突吗?
谢谢史蒂夫