実行環境
Rails 4.2.6
Bootstrap 3.3.7
Gem
gem 'pry-rails'
gem 'devise'
gem 'paperclip'
gem 'kaminari'
gem 'therubyracer'
gem 'twitter-bootstrap-rails'
gem 'bootstrap-material-design'
gem 'bootstrap-sass'
ちなみにgemはこんな感じです。
エラー内容
アイコンが表示されず、四角にバツがついたマークが出る。
原因
アイコンはfontsフォルダから読み込まれるが、これが何らかの原因で読み込まれていない。
解決法
そもそもfontsフォルダがないので、Bootstrapの公式サイトからダウンロードして来たfontsフォルダをapp/assets/
の下に置く。
その後、app/assets/stylesheets/application.scss
内に以下を追記する。
application.scss
@font-face {
font-family: ‘Glyphicons Halflings’;
src: url(‘/assets/glyphicons-halflings-regular.eot’);
src: url(‘/asstes/glyphicons-halflings-regular.eot?#iefix’) format(‘embedded-opentype’),
url(‘/assets/glyphicons-halflings-regular.woff’) format(‘woff’),
url(‘/assets/glyphicons-halflings-regular.ttf’) format(‘truetype’),
url(‘/assets/glyphicons-halflings-regular.svg#glyphicons-halflingsregular’) format(‘svg’);
}