0

For some reason my glyphicons are not displaying. When I look at the files in the inspector, they show up red, because they are byte 0. However I can access the links successfully:

http://admin.packagezen.com/assets/glyphicons-halflings-regular.woff

Font files exist but they come in with 0 bytes

Any idea, what is happening? Is it heroku perhaps? or rails? I put the fonts in /public/assets and the file exists when i ssh into the server.

Kamilski81
  • 14,409
  • 33
  • 108
  • 161
  • Do you need to configure rails to serve up `.woff` files as mime type `application/x-font-woff` (http://stackoverflow.com/questions/12644391/rails-3-web-font-woff-mime-type) – paul Oct 13 '14 at 14:42

2 Answers2

1

You can configure the rails assets pipeline to serve this for your. Do the following:

Drop that font in (not in public/assets):

/assets/fonts/glyphicons-halflings-regular.woff

Add the font face in your application.css that uses this font/url, this will reference the finger-printed version of this:

@font-face {
  font-family: 'Glyphicons';
  src: font-url("/assets/fonts/glyphicons-halflings-regular.woff") format("woff");
  font-weight: normal;
  font-style: normal;
}

Then feel free to use that name anywhere to reference that font. Try it out.

SomeDudeSomewhere
  • 3,928
  • 1
  • 23
  • 27
0

Did you add to the config/application.rb file the following (within class Application < Rails::Application)?

config.assets.paths << "#{Rails}/vendor/assets/fonts"

E.g. source: http://www.erikminkel.com/2013/09/01/twitter-bootstrap-3-in-a-rails-4-application/

userden
  • 1,615
  • 6
  • 26
  • 50