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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.