我在我的应用程序中使用Twitter Bootstrap,并使用Ruby Gem twitter-bootstrap-rails(2.2.8)
。我已经将Rails版本升级到Rails 4。
我正在使用以下Gem来处理资产:
gem 'less-rails'
gem 'coffee-rails'
gem 'twitter-bootstrap-rails'
gem 'execjs'
gem 'therubyracer', :platforms => :ruby
现在的问题是,font 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";
注:如果你在此处使用asset_path(),那么你编译的bootstrap_and_overrides.css将无法正确设置路径。所以目前我们使用绝对路径。
你需要使用绝对路径吗?这听起来像是一个可以通过Firebug解决的问题,请检查并查看正在加载什么。 - Petercopter