【Rails4】【bootstrap3】アイコンフォントを表示する

環境

Rails 4.1.8
Bootstrap3
twitter-bootstrap-rails 3.1.1

目的

gem でbootstrap3をインストールして、bootstrap3アイコンフォントが表示されること

1. fontsファイルをコピーする
bundle install したtwitter-bootstrap-railsのフォルダからfontsファイルをコピーして任意のファルダにペーストする
(今回はapp/assets/fontsフォルダを作成して使用)

2. config/application.rb に以下を追記
assetsパイプラインで読み込むファイルを追加する

  config.assets.paths << "#{Rails}/app/assets/fonts"
  # パスは1でペーストしたフォルダ

3. app/assets/stylesheets/application.css に以下を追記
assetsパイプライン用にパスを上書く

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../assets/glyphicons-halflings-regular.eot');
  src: url('../assets/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');
}