2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

twitter-bootstrap-railsでGryphiconを表示する

Posted at
Gemfile
gem 'therubyracer'
gem 'less-rails'
gem 'twitter-bootstrap-rails'

1. 公式サイトからBootstrap3のファイルをダウンロード

2. fontsディレクトリごとvendor/assets/fontsにコピー

3. config/application.rbにassetパスを追加

config/application.rb
class Application < Rails::Application
	config.assets.paths << "#{Rails}/vendor/assets/fonts"
end

4. CSSファイルに下記を追加

app/assets/stylesheets/application.css
@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');
}

5. herokuで使えるようにするためにプリコンパイルする

config/intiarazers/assets.rb
Rails.application.config.assets.precompile += %w( *.woff *.eot *.svg *.ttf )

参考

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?