Ruby on Rails Font Awesome setup

Setting up font awesome with Ruby on Rails is very quick and gives you access to all the font awesome…awesomeness.

Step 1.

Copy the font awesome files to app/assets/font

Step 2.

Add the font directory to the assets path in application.rb

config.assets.paths << Rails.root.join("app", "assets", "fonts")

Step 3.

Modify font-awesome.css as follows

@font-face {
  font-family: 'FontAwesome';
  src: url(/assets/fontawesome-webfont.eot);
  src: url(/assets/fontawesome-webfont.eot?#iefix) format('embedded-opentype'), url(/assets/fontawesome-webfont.woff) format('woff'), url(/assets/fontawesome-webfont.ttf) format('truetype'), url(/assets/fontawesome-webfont.svg#FontAwesome) format('svg');
  font-weight: normal;
  font-style: normal;
}

Step 4.
Move font-awesome.css to your assets/stylesheets directory and restart the rails server.
Done!

Leave a Reply

Your email address will not be published. Required fields are marked *