#Using Font-Awesome with Rails 3.1 using CSS
-
Download font-awesome from https://github.com/FortAwesome/Font-Awesome
-
Put the font folder in the app/assets. I renamed the folder from font to fonts to make it clearer
-
Add
config.assets.paths << "#{Rails.root}/app/assets/fonts"
toconfig/application.rb
. This is to include the apps/assets/fonts folder in the asset pipeline -
Put the font-awesome.css file in the app/assets/stylesheets folder
-
The first part of the css should be:
@font-face { font-family: 'FontAwesome'; src: url('fontawesome-webfont.eot'); src: url('fontawesome-webfont.eot?#iefix') format('embedded-opentype'), url('fontawesome-webfont.woff') format('woff'), url('fontawesome-webfont.ttf') format('truetype'), url('fontawesome-webfont.svgz#FontAwesomeRegular') format('svg'), url('fontawesome-webfont.svg#FontAwesomeRegular') format('svg'); font-weight: normal; font-style: normal; }
You should then be able to use:
<div style="font-size: 24px;">
<i class="icon-camera-retro"></i> icon-camera-retro
</div>
Thank you for this! I was screwing up the paths to the fonts in the font-awesome.css and this saved me.