diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2014-08-04 10:19:14 +0400 |
---|---|---|
committer | Gleb Mazovetskiy <glex.spb@gmail.com> | 2014-08-04 10:19:14 +0400 |
commit | 8f8cf6b27232662df5b1e9f4788b89b6824dc2f4 (patch) | |
tree | ef3cf33022703576a48219f9ffd243c625c55750 /README.md | |
parent | 4730db67a8136b87a55180a467dcbaefc73c3026 (diff) |
Update Rails guide [ci skip]
* Emphasize application.css.*scss* extension, because Rails 4.1
generates application.*css* by default
* Add Bower with Rails section
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -26,22 +26,42 @@ gem 'autoprefixer-rails' `bundle install` and restart your server to make the files available through the pipeline. -In `app/assets/stylesheets/application.css.scss`: +Import Bootstrap styles in `app/assets/stylesheets/application.css.scss`: ```scss @import "bootstrap-sprockets"; @import "bootstrap"; ``` +Make sure the file has `.css.scss` extension (or `.css.sass` for Sass syntax). + +If you have just generated a new Rails app, it may have an `application.css` file instead. +If this file exists, it will be served instead of Sass, so remove it: + +```console +$ rm app/assets/stylesheets/application.css +``` + Do not use `//= require` in Sass or your other stylesheets will not be [able to access][antirequire] the Bootstrap mixins or variables. -In `app/assets/javascripts/application.js`: +Require Bootstrap Javascripts in `app/assets/javascripts/application.js`: ```js //= require jquery //= require bootstrap-sprockets ``` +#### Bower with Rails + +When using bootstrap-sass Bower package in Rails, ensure [minimum number precision](#sass-number-precision): + +```ruby +# e.g. config/initializers/sass.rb +::Sass::Script::Number.precision = [10, ::Sass::Script::Number.precision].max +``` + +`bootstrap-sprockets` must be imported before `bootstrap` for the icon fonts to work. + #### Rails 3.2.x Rails 3.2 is [no longer maintained for bugfixes](http://guides.rubyonrails.org/maintenance_policy.html), and you should upgrade as soon as possible. |