You’ve decided your Ruby on Rails app needs to move from Bootstrap 4 to Bootstrap 5. Bootstrap 4 is end of life and no longer receives bug fixes or security updates. Maybe you also want to get jQuery out of your front end, or maybe a component you need only exists in version 5. The catch is that Bootstrap 5 renames classes and data attributes, and that touches many of the views in the app. In a large application, changing all of them in a single pull request is hard to review, hard to test, and hard to roll back.
We recently borrowed the idea behind the Dual-Boot technique , running two versions of a dependency side by side, for something other than Rails: Bootstrap itself. Instead of upgrading everything at once, we kept both versions in the app and moved one controller at a time, for many of the same reasons that you might upgrade Rails in increments . In this article, you will learn how to run Bootstrap 4 and 5 side by side in one Rails app, how to pick the version per controller with a layout, and how to sequence the migration into small pull requests.
Read more of Bootstrap 4 to 5, One Controller at a Time