3

I'm using the bootstrap-sass gem within my Rails 4 application and I have used Glpyphicons font that comes packed with bootstrap for icons across my application. In development, these icons show up fine. However, in any non-development environment, I get a 404 error for every reference to the Glyphicon font files.

I've determined that this is due to the fingerprinting that is done by the asset pipeline breaking the references in the Bootstrap stylesheets.

Bootstrap references these fonts as such:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url("bootstrap/glyphicons-halflings-regular.eot");
  src: url("bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("bootstrap/glyphicons-halflings-regular.woff") format("woff"), url("bootstrap/glyphicons-halflings-regular.ttf") format("truetype"), url("bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
}

However, a quick ls of the bootstrap folder shows that the names are different.

glyphicons-halflings-regular-293ade90ddeb5ceccd08b9b32ae97010.eot
glyphicons-halflings-regular-533d84fb5d3948367e1b51dde3a08b39.svg
glyphicons-halflings-regular-d381f367f3f48c9f7f775a043238f0f8.ttf
glyphicons-halflings-regular-e5b007f195d752fa4823febe5e66ef4e.woff

As you can see, each file has a fingerprint appended to it.

Removing these fingerprints fixes the issue. However, doing this manually is not ideal for deployment. Does anyone have any solutions for this? I'd like to avoid editing bootstrap-sass gem code if it can be helped.

Thanks!

John
  • 9,254
  • 12
  • 54
  • 75

1 Answers1

5

In your application.css.scss file ( or whichever .css file you are including for template )

You need to have

@import "bootstrap-sprockets";
@import "bootstrap";

I think you missed importing the bootstrap-sprockets file.