0

I created a fonts.css.scss file in fonts folder and given below format

@font-face {
  font-family: 'amandaregular';
  src: url(font-path('amanda-webfont.eot'));
}

it's generating with compiled fonts, but unable to load font-family

@font-face {
  font-family: 'amandaregular';
  src: url("http://localhost:3000/assets/amanda-webfont.eot");
}

1 Answers1

0

First make sure you add the fonts folder to the Asset pipeline load path in config/application.rb, and then restart your server:

config.assets.paths << Rails.root.join("app", "assets", "fonts")

Then place fonts.css.scss in app/assets/stylesheets and make sure it is included in your application.scss manifest. It should look like:

@font-face {
  font-family: 'amandaregular';
  src: url(font-path('amanda-webfont.eot?#iefix')) format('embedded-opentype');
}

Notice the above uses the Fontspring @font-face syntax.

Finally, make sure that the file amanda-webfont.eot is saved in app/assets/fonts

rlarcombe
  • 2,958
  • 1
  • 17
  • 22
  • Yes, i have already defined in application.rb, and given format('embedded-opentype'), still font-face don't change –  Nov 25 '15 at 11:01
  • I edited my answer. You need your fonts.css.scss saved in your stylesheets folder, but the font file itself saved in the fonts folder. – rlarcombe Nov 25 '15 at 11:09