bootstrap3とrails4のproduction環境でアイコンが表示できない問題
自分の本番環境で起きていたのは、cssからのリクエストでfontファイルにダイジェストがついていなくて404になっていた。
なおfontの4ファイルはprecompileできてた。
asset_pathヘルパー使ってダイジェストつけるようにした。
# app/assets/stylesheets/bootstrap_and_overrides.less.erb ... ... @font-face { font-family: 'Glyphicons Halflings'; src: url(<%= asset_path('glyphicons-halflings-regular.eot') %>); src: url(<%= asset_path('glyphicons-halflings-regular.eot?#iefix') %>) format('embedded-opentype'), url(<%= asset_path("glyphicons-halflings-regular.woff") %>) format('woff'), url(<%= asset_path("glyphicons-halflings-regular.ttf") %>) format('truetype'), url(<%= asset_path('glyphicons-halflings-regular.svg#glyphicons-halflingsregular') %>) format('svg'); }
precompileするとファイル名変わるしで見落とし多くてだいぶ疲れました以上。
追記
https://github.com/seyhunak/twitter-bootstrap-rails#icons を使おう
IconsBy default, this gem overrides standard Bootstraps's Glyphicons with Font Awesome (http://fortawesome.github.com/Font-Awesome/).
This should appear inside _bootstrap_and_overrides (based on you twitter-bootstrap-rails version)
From 2.2.7
// Font Awesome
@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
@import "fontawesome/font-awesome";