{"id":13687223,"url":"https://github.com/twbs/bootstrap-rubygem","last_synced_at":"2025-05-14T21:00:22.084Z","repository":{"id":44452096,"uuid":"41397625","full_name":"twbs/bootstrap-rubygem","owner":"twbs","description":"Bootstrap rubygem for Rails / Sprockets / Hanami / etc","archived":false,"fork":false,"pushed_at":"2025-04-20T20:01:20.000Z","size":5619,"stargazers_count":2034,"open_issues_count":47,"forks_count":443,"subscribers_count":62,"default_branch":"main","last_synced_at":"2025-05-07T20:28:51.202Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/bootstrap","language":"SCSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/twbs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"twbs","open_collective":"bootstrap"}},"created_at":"2015-08-26T01:39:19.000Z","updated_at":"2025-04-26T15:37:30.000Z","dependencies_parsed_at":"2024-04-15T06:30:38.461Z","dependency_job_id":"650e8684-4fc4-4bb4-a3ab-e865d02a8d0d","html_url":"https://github.com/twbs/bootstrap-rubygem","commit_stats":{"total_commits":1072,"total_committers":131,"mean_commits":8.183206106870228,"dds":0.4225746268656716,"last_synced_commit":"1e6b6b24afe23fe93042a413b4e9cf8dbc1f0a3e"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twbs%2Fbootstrap-rubygem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twbs%2Fbootstrap-rubygem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twbs%2Fbootstrap-rubygem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twbs%2Fbootstrap-rubygem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twbs","download_url":"https://codeload.github.com/twbs/bootstrap-rubygem/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253610888,"owners_count":21935778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T15:00:50.578Z","updated_at":"2025-05-14T21:00:22.024Z","avatar_url":"https://github.com/twbs.png","language":"SCSS","funding_links":["https://github.com/sponsors/twbs","https://opencollective.com/bootstrap"],"categories":["Official resources","SCSS","Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# Bootstrap Ruby Gem [![CI](https://github.com/twbs/bootstrap-rubygem/actions/workflows/ci.yml/badge.svg)](https://github.com/twbs/bootstrap-rubygem/actions/workflows/ci.yml) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)\n\n[Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*/*Importmaps*) and Hanami (formerly Lotus).\n\nFor Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead.\n\n**Ruby on Rails Note**: Newer releases of Rails have added additional ways for\nassets to be processed. The `twbs/bootstrap-rubygem` is for use with Importmaps\nor Sprockets, but not Webpack.\n\n## Installation\n\nPlease see the appropriate guide for your environment of choice:\n\n* [Ruby on Rails 4+](#a-ruby-on-rails) or other Sprockets environment.\n* [Other Ruby frameworks](#b-other-ruby-frameworks) not on Rails.\n\n\n### a. Ruby on Rails\n\nAdd `bootstrap` to your Gemfile:\n\n```ruby\ngem 'bootstrap', '~\u003e 5.3.3'\n```\n\nThis gem requires a Sass engine, so make sure you have **one** of these gems in your Gemfile:\n- [`dartsass-sprockets`](https://github.com/tablecheck/dartsass-sprockets): Dart Sass engine, recommended but only works for Ruby 2.6+ and Rails 5+\n- [`dartsass-rails`](https://github.com/rails/dartsass-rails): Dart Sass engine, recommended for Rails projects that use Propshaft\n- [`cssbundling-rails`](https://github.com/rails/cssbundling-rails): External Sass engine\n- [`sassc-rails`](https://github.com/sass/sassc-rails): SassC engine, deprecated but compatible with Ruby 2.3+ and Rails 4\n\nAlso ensure that `sprockets-rails` is at least v2.3.2.\n\nFor wider browser compatibility, use [Autoprefixer][autoprefixer].\nIf you are using Rails, add the `autoprefixer-rails` gem to your app and ensure you have a JavaScript runtime (e.g. NodeJS).\n\n`bundle install` and restart your server to make the files available through the pipeline.\n\nImport Bootstrap styles in `app/assets/stylesheets/application.scss`:\n\n```scss\n// Custom bootstrap variables must be set or imported *before* bootstrap.\n@import \"bootstrap\";\n```\n\nThe available variables can be found [here](assets/stylesheets/bootstrap/_variables.scss).\n\nMake sure the file has `.scss` extension (or `.sass` for Sass syntax). If you have just generated a new Rails app,\nit may come with a `.css` file instead. If this file exists, it will be served instead of Sass, so rename it:\n\n```console\n$ mv app/assets/stylesheets/application.css app/assets/stylesheets/application.scss\n```\n\nThen, remove all the `*= require` and `*= require_tree` statements from the Sass file. Instead, use `@import` to import Sass files.\n\nDo not use `*= require` in Sass or your other stylesheets will not be able to access the Bootstrap mixins and variables.\n\nBootstrap JavaScript can optionally use jQuery.\nIf you're using Rails 5.1+, you can add the `jquery-rails` gem to your Gemfile:\n\n```ruby\ngem 'jquery-rails'\n```\n\nBootstrap tooltips and popovers depend on [popper.js] for positioning.\nThe `bootstrap` gem already depends on the\n[popper_js](https://github.com/glebm/popper_js-rubygem) gem.\n\n#### Importmaps\n\nYou can pin either `bootstrap.js` or `bootstrap.min.js` in `config/importmap.rb`\nas well as `popper.js`:\n\n```ruby\npin \"bootstrap\", to: \"bootstrap.min.js\", preload: true\npin \"@popperjs/core\", to: \"popper.js\", preload: true\n```\n\nWhichever files you pin will need to be added to `config.assets.precompile`:\n\n```ruby\n# config/initializers/assets.rb\nRails.application.config.assets.precompile += %w(bootstrap.min.js popper.js)\n```\n\n#### Sprockets\n\nAdd Bootstrap dependencies and Bootstrap to your `application.js`:\n\n```js\n//= require jquery3\n//= require popper\n//= require bootstrap-sprockets\n```\n\nWhile `bootstrap-sprockets` provides individual Bootstrap components\nfor ease of debugging, you may alternatively require\nthe concatenated `bootstrap` for faster compilation:\n\n```js\n//= require jquery3\n//= require popper\n//= require bootstrap\n```\n\n### b. Other Ruby frameworks\n\nIf your framework uses Sprockets or Hanami,\nthe assets will be registered with Sprockets when the gem is required,\nand you can use them as per the Rails section of the guide.\n\nOtherwise you may need to register the assets manually.\nRefer to your framework's documentation on the subject.\n\n## Configuration\n\n### Sass: Individual components\n\nBy default all of Bootstrap is imported.\n\nYou can also import components explicitly. To start with a full list of modules copy\n[`_bootstrap.scss`](assets/stylesheets/_bootstrap.scss) file into your assets as `_bootstrap-custom.scss`.\nThen comment out components you do not want from `_bootstrap-custom`.\nIn the application Sass file, replace `@import 'bootstrap'` with:\n\n```scss\n@import 'bootstrap-custom';\n```\n\n[bootstrap-home]: https://getbootstrap.com\n[bootstrap-variables.scss]: https://github.com/twbs/bootstrap-rubygem/blob/master/templates/project/_bootstrap-variables.scss\n[autoprefixer]: https://github.com/ai/autoprefixer\n[popper.js]: https://popper.js.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwbs%2Fbootstrap-rubygem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwbs%2Fbootstrap-rubygem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwbs%2Fbootstrap-rubygem/lists"}