Search code examples
ruby-on-railstwitter-bootstrapherokubootstrap-sass

Bootstrap sass gem conflicts between versions 2&3


I'm using bootstrap-sass gem in my Rails project with version 2.3.1.0. However, when pushed up to Heroku, I'm getting the Bootstrap 3 styles. I inspect the CSS style and it indeed does say Bootstrap version 3.

On local, the assignment seems to be correct. But equally perplexing, when I inspect the CSS file, it says Bootstrap version 3 despite displaying what looks like the Bootstrap 2.3 styles.

I think at one point, my bootstrap-sass gem was using the Bootstrap 3, but when I put it back to gem 'bootstrap-sass', '2.3.1.0', I'm getting this strange conflict. I really just want my Heroku app to display the styles correctly. Even though I'm pushing up my current local version to Heroku, it is still using Bootstrap 3 stylings.

Here's what I've got:

Gemfile:

group :assets do
    gem 'sass-rails',   '~> 3.2.3'
    gem 'coffee-rails', '~> 3.2.1'
    gem 'uglifier', '>= 1.0.3'
    gem 'bootstrap-sass', '2.3.1.0'
end

I've created a styles.css.scss file, where I have the line @import "bootstrap";Here's what it looks like on localhost:

enter image description here

Here's what it looks like on Heroku:

enter image description here


Solution

  • Not sure why this worked, but I found the second answer here to work for me.

    I added *= require bootstrap" right above " *= require_tree . in application.css.

    Then ran "bundle install --without production", followed by "rake assets:precompile". Committed the changes to git and then pushed to heroku.

    I've never had to specifically require bootstrap in the asset pipeline before, but it works!