How to install the bootstrap-sass gem
- Add bootstrap-sass gem to the Gemfile:
gem 'bootstrap-sass', '~> 3.3', '>= 3.3.6'
or install it from your terminal:gem install bootstrap-sass -v 3.3.6
- Restart the server (
ctrl+c
,rails s
) to make the files available through the pipeline - Rename file extension
app/assets/stylesheets/application.css
to.scss
- In the bottom of this file (don’t touch anything else), add:
// "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
@import "bootstrap-sprockets";
@import "bootstrap";
- In the file
app/assets/javascripts/application.js
add:
//= require jquery
//= require bootstrap-sprockets
- Refresh your project page in the browser (localhost:3000) – it will look boostrap-styled after that
- If you have the file
app/assets/stylesheets/scaffolds.scss
, you can delete everything inside it since it will be overridden by bootstrap anyway
Useful links:
bootstrap-sass on Rubygems
bootstrap-sass documentation
SO: difference between bootstrap-sass and twitter-bootstrap-rails gems
bootstrap-sass vs twitter-bootstrap-rails
twitter-bootstrap-rails
this gem offers not only bootstrap itself, but also some handy helpers and a layout generator
bootstrap-sass
– official bootstrap gem