Skip to content

Instantly share code, notes, and snippets.

@tagrudev
Created December 13, 2012 13:46
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save tagrudev/4276467 to your computer and use it in GitHub Desktop.
Save tagrudev/4276467 to your computer and use it in GitHub Desktop.
Add custom fonts to your rails application
##
Lets say we have YoloFont.otf
1. We add it to vendor/assets/fonts/ folder
2. Me personaly creates a file named fonts.css.scss in app/assets/stylesheets
In it I have
@font-face{
font-family: 'YoloFont';
src: font-url("YoloFont.otf") unquote("format('opentype')");
font-weight: normal;
font-style: normal;
}
3. Mark the opentype it may vary to your font format
4. In your app/assets/stylesheets/application.css.scss
@import "fonts";
$my_yolo_font: 'YoloFont';
5. You can use it with
font-family: $my_yolo_font;
@ksarna
Copy link

ksarna commented May 15, 2014

Thanks for this!

@stjhimy
Copy link

stjhimy commented Jul 6, 2014

Thanks.

@patriques82
Copy link

Thanks

@vprigent
Copy link

Thanks !
Depending on your setup, @import does not work.
Just add *= require fonts before *= require_tree .

@sudhirsb2003
Copy link

Thanks ! Superb Guide

@NjoohOld
Copy link

NjoohOld commented Nov 3, 2016

Thanks !!!

@JeremyEllingham
Copy link

Cheers.

@nullset2
Copy link

What if I'm not using Sass?

@jwaiswa7
Copy link

Thanks

@AndreaBazan
Copy link

Thanks!!! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment