Rails foundationSort Order

Rails: Upgrading to Bootstrap 4.1

Upgrading to Bootstrap 4.1 has been something asked for by a lot of our students. In this episode we'll outline exactly everything you need to do to upgrade your codebase to using bootstrap 4.1

Switching Gems

Bootstrap now has a new ruby gem so we'll need to switch it in our Gemfile

# fromgem 'bootstrap-sass'# togem 'bootstrap', '~> 4.1.3'

Now we can run bundle install and we should have the new version of bootstrap installed.

Modifying our App Code

Once the new gem is installed we'll need to modify our app/assets/stylesheets/application.sass

// remove@import "bootstrap-sprockets"// add @import "bootstrap"@import "bootstrap-grid"

That should be it in terms of using the new bootstrap library. We won't worry about the javascript part for now, we'll cover that in the upcoming Rails Intermediate series.

You can now boot up your rails application to see the changes. Be aware that this will break your UI. In the upcoming episodes we will be cleaning up the ui / ux to use the new bootstrap classes.