2013年2月6日水曜日

[Rails3.2.11]大好きなfont awesomeをrailsに追加する方法

1.gemfileに 
gem 'font-awesome-rails'
2.
$ bundle install
3.application.cssに
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_self
 *= require_tree .
 *= require font-awesome  //これを追加
 */

4.使いたいscss.css内に
// Place all the styles related to the stores controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

@import "font-awesome";  //これを追加
以上。


<h1>
<i class="icon-camera-retro icon-large"></i>Listing bear</h1>




こんな感じに可愛いアイコンをすぐに追加できます。