Skip to content

Instantly share code, notes, and snippets.

@stevenyap
Created May 5, 2014 08:25
Show Gist options
  • Select an option

  • Save stevenyap/11531381 to your computer and use it in GitHub Desktop.

Select an option

Save stevenyap/11531381 to your computer and use it in GitHub Desktop.
Font Linking for SASS in Rails

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