Today I Learned

hashrocket A Hashrocket project

Make fonts work with asset pipeline on production

If you encounter a problem where fonts don't work on production when using Bourbon CSS toolset, you need to replace the font declaration from:

font-face("great-font","/assets/greatfont")

to

@include font-face("greatfont", "greatfont", $asset-pipeline: true)

This will use asset pipeline fingerprinted URL in the font declaration and should work on all environments.

P.S. With rails 4.0+ you only need to put font files in app/assets/fonts and they will be fingerprinted and zipped.

See More #rails TILs
Looking for help? Hashrocket has been an industry leader in Ruby on Rails since 2008. Rails is a core skill for each developer at Hashrocket, and we'd love to take a look at your project. Contact us and find out how we can help you.