Install Bootstrap in Ruby on Rails (Sprockets/Importmaps)
mainTo use Bootstrap 5 in a Ruby on Rails application, add the bootstrap gem to your Gemfile. This gem requires a Sass engine to process styles.
Required Sass Engines (choose one):
dartsass-sprockets(Recommended for Ruby 2.6+ and Rails 5+)dartsass-rails(Recommended for Rails projects using Propshaft)cssbundling-rails(External Sass engine)sassc-rails(Deprecated, compatible with Ruby 2.3+ and Rails 4)
Prerequisites:
sprockets-railsmust be at leastv2.3.2.- For browser compatibility, add
autoprefixer-railsand ensure a JavaScript runtime (like NodeJS) is installed. - For Bootstrap JavaScript tooltips/popovers, the gem includes
popper_js, but you may want to addjquery-railsif you require jQuery support.