Font awesome not loading icons - Rails 4

I use twitter bootstrap in my application, and for this I use ruby ​​gem twitter-bootstrap-rails (2.2.8). I upgraded the rails version to rails 4.

I use the following gems for assets

gem 'less-rails'
gem 'coffee-rails'
gem 'twitter-bootstrap-rails'
gem 'execjs'
gem 'therubyracer', :platforms => :ruby

Now the problem is that the awesome font icon is not loading. It should load magnifier glass according to my HTML<button type="submit" class="btn"><i class="icon-search"></i></button>

enter image description here

Here is my 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";
+4
source share
2 answers

I don’t know what the problem is, but I included it gem "font-awesome-rails"in mine Gemfileand *= require font-awesomemine application.css, after which everything worked fine.

+8
source

you can also try:

@font-face {
  font-family: "FontAwesome";
  src: url('<%= asset_path("fontawesome-webfont.eot") %>');
  src: url('<%= asset_path("fontawesome-webfont.eot") + "?#iefix" %>')   format('eot'), url('<%= asset_path("fontawesome-webfont.woff") %>') format('woff'), url('<%= asset_path("fontawesome-webfont.ttf") %>') format('truetype'), url('<%= asset_path("fontawesome-webfont.svg") + "#FontAwesome" %>') format('svg');
  font-weight: normal;
  font-style: normal;
  }
0

Source: https://habr.com/ru/post/1524760/


All Articles