Currently I trying to add custom fonts into my Rails 4 application.
- I added all of my fonts into
assets/fonts
- I added
config.assets.paths << Rails.root.join("app", "assets", "fonts")
intoconfig/application.rb
- I added script into my
style.css
@font-face {
font-family: 'oxygenregular';
src: url(font-path('oxygen-regular-webfont.eot') + "?#iefix") format('embedded-opentype'),
url(font-path('oxygen-regular-webfont.woff')) format('woff'),
url(font-path('oxygen-regular-webfont.ttf')) format('truetype'),
url(font-path('oxygen-regular-webfont.svg') + "#MyFont") format('svg');
}
body {
font-family: 'oxygenregular', arial;
background: #f4f5f9;
background-image: url(../images/bg-pattern.png);
background-position: 0 bottom;
background-repeat: no-repeat;
}
I don't get any error like 404 (Not Found)
, since I got the error before modified config/application.rb
But the application doesn't load the font that I already put. I tried on native HTML and the fonts are working well, but when I trying to put them into Rails application, it doesn't load.a