Search code examples
ruby-on-railssassbundlergemfilebootstrap-sass

How to update sass along with bootstrap-sass in my Rails app?


In Gemfile I had:

gem 'bootstrap-sass', '~> 3.0.3.0'

I have now changed it to the following, which is the latest version at the time of this writing:

gem 'bootstrap-sass', '~> 3.1.1.1'

Taking a look at both bootstrap-sass (3.0.3.0) and bootstrap-sass (3.1.1.1) on RubyGems.org, I see that both versions have runtime dependencies of:

sass ~> 3.2

Taking a look at sass itself, I see that it has no runtime dependencies, and that its latest version is:

gem 'sass', '~> 3.3.7'

After making the change mentioned above (to bootstrap-sass) I ran bundle, and saw the following:

...
Using sass 3.2.19
Installing bootstrap-sass 3.1.1.1 (was 3.0.3.0)
...

My question is why wasn't sass updated, and how can I update it without referencing it in Gemfile?

For what it's worth, here is some more info:

-bash> grep sass Gemfile.lock 
    bootstrap-sass (3.1.1.1)
      sass (~> 3.2)
      sass-rails (~> 4.0)
    sass (3.2.19)
    sass-rails (4.0.3)
      sass (~> 3.2.0)
  bootstrap-sass (~> 3.1.1.1)
  sass-rails (~> 4.0.3)

Solution

  • As you noted, both bootstrap-sass versions (3.0.3.0 and 3.1.1.1) have a dependency of:

    sass ~> 3.2
    

    What this means is that they require the highest 3.2.x version of sass, but not 3.3. That's what the ~> means, and that is why your sass is 3.2.19.

    So even if you explicitly say:

    gem 'sass', '~> 3.3.7'
    

    Bundler won't update it because it sees that bootstrap-sass depends on a lower version of sass.