Bootstrap Rubygem

screenshot of Bootstrap Rubygem

Bootstrap rubygem for Rails / Sprockets / Hanami / etc

Overview

The Bootstrap Ruby gem, designed for Ruby on Rails and Hanami applications, provides integration for Bootstrap styles and JavaScript functionalities. It is tailored for environments using Sprockets or Importmaps, offering a streamlined way to include Bootstrap components in web projects.

Features

  • Compatibility: Works with Ruby on Rails (Sprockets/Importmaps) and Hanami frameworks.
  • Sass Engine: Requires a Sass engine like dartsass-sprockets or dartsass-rails for Ruby on Rails projects.
  • Autoprefixer Support: Enhances browser compatibility with the autoprefixer-rails gem.
  • Bootstrap JavaScript Integration: Facilitates the optional use of jQuery and popper.js for Bootstrap components.
  • Configuration Options: Allows for customizing Bootstrap imports and components to streamline asset management.

Ruby on Rails:

  1. Add the Bootstrap gem to your Gemfile.
  2. Include a Sass engine (e.g., dartsass-sprockets) and sprockets-rails gem.
  3. Use autoprefixer-rails for wider browser support.
  4. Import Bootstrap styles in application.scss file using @import statements.
  5. Ensure correct file extensions (.scss) and remove *= require statements.
  6. Optionally integrate jQuery and popper.js.
  7. Update importmap.rbr and config.assets.precompile for Importmaps support.
  8. Add Bootstrap dependencies to your application.js.