rails/Heroku: custom fonts working in local but not on Heroku

I have a problem with my custom fonts on Rails 4.

I put the fonts in /vendor/assets/fonts/ directory, and in my application.rb, I added:

config.assets.paths << "#{Rails}/vendor/assets/fonts"
config.assets.precompile << /\.(?:svg|eot|woff|ttf)$/

In addition, in my production.rb config file, I have:

config.serve_static_assets = true

I'm using sass so in my css, I added:

@font-face
  font-family: 'Raleway-Thin'
  src: url('Raleway-Thin.ttf')

....
font-family: "Raleway-Thin", sans-serif

In my application.css, I also added because i'm using font-awesome:

 *= require font-awesome.min

I'm pushing on Heroku, and my fonts are ot loaded, it's not working...

Do you have any ideas what's the problem please, (or if there is any command to type before/after pushing)?

Thanks by advance

Answers


Have you tried using the helper function and utilize the Rails asset pipeline?

@font-face
  font-family: 'Raleway-Thin'
  src: font-url('Raleway-Thin.ttf')

You can import font into folder assest/stylesheet/font and run bundle exec rake assets:precompile before deploy to heroku. I has tried and it's work. In addition, I have search font name that you have used, so I recommended you can using Google Web Font for this font: http://www.google.com/fonts#UsePlace:use/Collection:Raleway


Need Your Help

Changing MAC address under Windows 8 on wireless device

windows networking network-programming

I want to spoof MAC Address on wireless device in Windows 8.1. I'm able to do this but with only specific MAC addresses. I can't put MAC address that I want. Is there anyway to do this through rege...

C++ most robust way to copy a file

c++ copy memory-efficient robustness robust

Okay, so I know that disk writing errors are very rare, so please just look past that because the data I am working with is very incredibly important (like SSIDs kind of important). So, I want to c...