Skip to content

Instantly share code, notes, and snippets.

@qcam
Created May 3, 2014 00:20
Show Gist options
  • Save qcam/11489336 to your computer and use it in GitHub Desktop.
Save qcam/11489336 to your computer and use it in GitHub Desktop.
[Rails Assets Pipeline] How to make web fonts work on Heroku

How to make web fonts work on Heroku

Add the fonts path to your production.rb and development.rb

# Add the font path
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')

# Include font files to Assets
config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/

Use font-url (SCSS helper) instead of url

@font-face {
  font-family: 'Icomoon';
  src: font-url("icomoon.eot");
  src: font-url("icomoon.eot?#iefix") format("embedded-opentype"), font-url("icomoon.svg#icomoon") format("svg"), font-url("icomoon.woff") format("woff"), font-url("icomoon.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment