cd to your rails app and mkdir app/assets/fonts
- Browse to fontello.com
- Choose your fontello icons
- Click 'Download webfont'
Unzip the fontello download then:
cp ~/Downloads/fontello-#{hash}/font/* app/assets/fonts/
cp ~/Downloads/fontello-#{hash}/config.json app/assets/fonts/
(Optional, but recommended)
cp ~/Download/fontello-#{hash}/css/fontello.css app/assets/stylesheets/fontello.css.scss
cp ~/Download/fontello-#{hash}/css/fontello-codes.css app/assets/stylesheets/
If you want to support IE 7 or animations, move the approriate CSS files into your app, too.
Replace all instances of url
in fontello.css.scss
with asset-url
.
For example: change url('../font/fontello.eot?37927143')
to asset-url("fontello.eot", "fonts")
There should be a block at the bottom like this:
.icon-emo-devil:before { content: '\e805'; } /* '' */
.icon-emo-sunglasses:before { content: '\e809'; } /* '' */
.icon-emo-angry:before { content: '\e80d'; } /* '' */
Delete it! Those same lines are in fontello-codes.css that we copied earlier. (This will make adding and removing icons easier)
There's an example fontello.css.scss at the bottom of this gist.
i.icon-emo-angry
%i.icon-emo-angry
<i class="icon-emo-angry"></i>
Note: In rails 4 there is a helper method
font-url
So this:
Can be changed to this