-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fonts are not included correctly #1204
Comments
With the following quick-fix, at least the icons are displayed now. First, copy the file Then add somewhere in your CSS: @at-root
@font-face
font-family: 'Glyphicons Halflings'
src: font-url('bootstrap/glyphicons-halflings-regular.woff2') format('woff2') Still, there are failing requests for missing font files, which leads to slow loading behaviour. Very annoying, all of this. |
Digging deeper into the issue, I wonder whether it has something to do with the following. Because glyphicons didn't show, I had to tweak the $icon-font-path: '/assets/bootstrap/' I got this here: https://gist.github.com/iamatypeofwalrus/6467148 I tried removing this (hoping that some gem update might have fixed this problem, so the above work-around would be obsolete now), but then the fonts still are not found: I also did various attempts on adding the correct path to the assets pipeline; some of them were: Rails.application.config.assets.paths << 'fonts'
Rails.application.config.assets.paths << 'bootstrap'
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'bootstrap')
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts', 'bootstrap')
Rails.application.config.assets.paths << Rails.root.join('assets', 'fonts', 'bootstrap')
Rails.application.config.assets.paths << Rails.root.join('fonts', 'bootstrap')
Rails.application.config.assets.paths << Rails.root.join('vendor', 'fonts', 'bootstrap') The font files live under So I'm not sure why neither of the specified paths would fix the problem. I'm close to removing glyphicons altogether from my project and stick to FontAwesome, but I'd really like to solve problems instead of working around them. |
According to https://stackoverflow.com/questions/31468298/some-glyphicons-not-working-with-bootstrap-sass#answer-33821399, the following is the most painless solution for me now: @font-face {
font-family:'Glyphicons Halflings';
src: font-url("bootstrap/glyphicons-halflings-regular.eot");
src: font-url("bootstrap/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"),
font-url("bootstrap/glyphicons-halflings-regular.woff") format("woff"),
font-url("bootstrap/glyphicons-halflings-regular.ttf") format("truetype"),
font-url("bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg")
}
|
As described in Rails asset pipeline: custom font does not load (hash not appended to file name in compiled CSS), my Rails app suddenly didn't serve custom fonts anymore.
Thanks to the folks on StackOverflow, I could fix the problem by changing
src: url(...)
tosrc: font-url(...)
when loading the font file in the CSS.Before:
After:
This worked for me, but apparently, Bootstrap-Sass still does it the old way:
Should this be changed to use
font-url
, too?The text was updated successfully, but these errors were encountered: