font-awesome-rails

https://github.com/bokmann/font-awesome-rails

HTML

the font-awesome font bundled as an asset for the rails asset pipeline

FontAwesome::Rails::IconHelper#fa_icon

Creates an icon tag given an icon name and possible icon
modifiers.

Examples

  fa_icon "camera-retro"
  # => <i class="fa fa-camera-retro"></i>

  fa_icon "camera-retro", text: "Take a photo"
  # => <i class="fa fa-camera-retro"></i> Take a photo
  fa_icon "chevron-right", text: "Get started", right: true
  # => Get started <i class="fa fa-chevron-right"></i>

  fa_icon "camera-retro 2x"
  # => <i class="fa fa-camera-retro fa-2x"></i>
  fa_icon ["camera-retro", "4x"]
  # => <i class="fa fa-camera-retro fa-4x"></i>
  fa_icon "spinner spin lg"
  # => <i class="fa fa-spinner fa-spin fa-lg">

  fa_icon "quote-left 4x", class: "pull-left"
  # => <i class="fa fa-quote-left fa-4x pull-left"></i>

  fa_icon "user", data: { id: 123 }
  # => <i class="fa fa-user" data-id="123"></i>

  content_tag(:li, fa_icon("check li", text: "Bulleted list item"))
  # => <li><i class="fa fa-check fa-li"></i> Bulleted list item</li>

Source | Google | Stack overflow

Edit

git clone [email protected]:bokmann/font-awesome-rails.git

cd font-awesome-rails

open app/helpers/font_awesome/rails/icon_helper.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-FontAwesome--Rails--IconHelper-fa_icon-for-pr


# Commit to git

git add app/helpers/font_awesome/rails/icon_helper.rbgit commit -m "better docs for FontAwesome::Rails::IconHelper#fa_icon"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-FontAwesome--Rails--IconHelper-fa_icon-for-pr

hub pull-request


# Celebrate!