1

According to the changelog twitter-bootstrap-rails gem supports font awesome since v.2.0.9. So how to turn on this support in project? Font awesome icons are not available for me by default.

tiktak
  • 1,801
  • 2
  • 26
  • 46

4 Answers4

3

It is now supported in twitter-bootstrap-rails by default.

Just add icons into your html code, like this:

<i class="icon-refresh"></i>

More icons and examples here: http://fortawesome.github.com/Font-Awesome/

denis.peplin
  • 9,585
  • 3
  • 48
  • 55
2

The twitter-bootstrap-rails gem has more dependencies since twitter bootstrap css uses LESS. In order to turn font-awesome on in your project you need to add

gem 'less-rails'

gem 'therubyracer'

in the :assets group of your Gemfile. After that you are able to use it in your project.

Pavel Nikolov
  • 9,401
  • 5
  • 43
  • 55
1

See the Using Font Awesome wiki page in their GitHub project. It is more recent than the v2.0.9 release, so I assume it is the current recommended practice.

merv
  • 67,214
  • 13
  • 180
  • 245
1

You can add icons to your HTML code, like this:

<i class="icon-search"></i>

However, if you want place icons in Rails link_to helper use the ilink_to helper method. Follow the steps below:

1) Add the gem to your assets group in the Gemfile: gem 'less-rails-fontawesome'

2) Run bundle install:

3) Be sure that @import 'fontawesome'; is uncommented in app/assets/stylesheetes/bootstrap_and_overrides.css.less.

4) Use *ilink_to* helper instead of *link_to* helper.

<%= ilink_to "upload-alt", "Edit", edit_post_path(post), class: 'btn btn-mini' %>

Obs: Precede the link text with the icon name stripped off icon- prefix

These instructions are here: https://github.com/wbzyl/less-rails-fontawesome

Duany Dreyton
  • 176
  • 1
  • 4