Adding bootstrap to rails

158 views Asked by At
2

There are 2 answers

0
Gurudath BN On

Steps to include bootstrap with rails

1) Add Bootstrap gem in Gemfile

gem 'bootstrap-sass'

gem 'sass-rails'

2) bundle install

3)Add bootstrap css to assets

Rename application.css in app/assets/stylesheets/application.css to app/assets/stylesheets/application.css.sass then you can import bootstrap assets

@import "bootstrap-sprockets"
@import "bootstrap"

4)Add bootstrap javascript to assets

Go to app/assets/javascripts/application.js

//= require bootstrap-sprockets

/*Use this after the jquery require in this file*/

This steps work fine for me.

1
Richard Hamilton On

The problem is with using bootstrap-sass. It most likely is a problem with that gem's dependencies. You need to include sass-rails.

gem 'sass-rails', '~> 4.0.0'

This should solve it.