LoginSignup
19
19

More than 5 years have passed since last update.

Rails 4 + Bower + Bootstrap 3 + Font Awesome 4

Last updated at Posted at 2014-01-22

Rails 4.0 + Bower + Twitter Bootstrap 2.3 のアップデートです。

一番の問題は Web Font をどうするかです。これには Web Font のパスが変数になっていることを利用し、その変数に cdnjs のパスを設定することで解決しました。cdnjs ではすでに Access-Control-Allow-Origin: * も設定されており、CORS の問題も解決されているので、面倒な設定をする必要がありません。

application.rb の設定

いらなくなりました。less-rails 2.4.1 のこのコミットで修正されたものと思われます。

Bootstrap の設定

app/assets/stylesheets/bootstrap.css.less

@import 'bootstrap/less/bootstrap';
@icon-font-path: '//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/fonts/';

app/assets/javascripts/bootstrap.js

//= require bootstrap/js/transition
//= require bootstrap/js/alert
//= require bootstrap/js/modal
//= require bootstrap/js/dropdown
//= require bootstrap/js/scrollspy
//= require bootstrap/js/tab
//= require bootstrap/js/tooltip
//= require bootstrap/js/popover
//= require bootstrap/js/button
//= require bootstrap/js/collapse
//= require bootstrap/js/carousel
//= require bootstrap/js/affix

Font Awesome の設定

app/assets/stylesheets/font-awesome.css.less

@import 'font-awesome/less/font-awesome';
@fa-font-path: '//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/fonts';

参考

19
19
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
19
19