Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap-rubygem.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHartley McGuire <hartley.mcguire@shopify.com>2022-07-13 21:59:42 +0300
committerGleb Mazovetskiy <glex.spb@gmail.com>2022-07-25 23:46:24 +0300
commit49a70a4933a1e3dbf8ec06e29fc2ed170f25ccd7 (patch)
tree330318fbe70e66f5761056d4191c91a09f40b298
parent003c627ea7589dbbd8aeff030353b8c5decb6fbf (diff)
Add Importmaps section to README
As importmap-rails is the default way to use javascript starting in Rails 7, this should help users wanting to use Bootstrap without using node.
-rw-r--r--README.md26
1 files changed, 23 insertions, 3 deletions
diff --git a/README.md b/README.md
index 9f4bc93..bf11bd4 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,12 @@
# Bootstrap Ruby Gem [![Build Status](https://travis-ci.org/twbs/bootstrap-rubygem.svg?branch=master)](https://travis-ci.org/twbs/bootstrap-rubygem) [![Gem](https://img.shields.io/gem/v/bootstrap.svg)](https://rubygems.org/gems/bootstrap)
-[Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*) and Hanami (formerly Lotus).
+[Bootstrap 5][bootstrap-home] ruby gem for Ruby on Rails (*Sprockets*/*Importmaps*) and Hanami (formerly Lotus).
For Sass versions of Bootstrap 3 and 2 see [bootstrap-sass](https://github.com/twbs/bootstrap-sass) instead.
-**Ruby on Rails 6 Note:**:
-With the release of Rails 6 there have been some minor changes made to the default configuration for The Asset Pipeline. In specific, by default _Sprockets no longer processes JavaScript_ and instead Webpack is set as the default. The `twbs/bootstrap-rubygem` is for use with Sprockets not Webpack.
+**Ruby on Rails Note**: Newer releases of Rails have added additional ways for
+assets to be processed. The `twbs/bootstrap-rubygem` is for use with Importmaps
+or Sprockets, but not Webpack.
## Installation
@@ -58,6 +59,25 @@ Bootstrap tooltips and popovers depend on [popper.js] for positioning.
The `bootstrap` gem already depends on the
[popper_js](https://github.com/glebm/popper_js-rubygem) gem.
+#### Importmaps
+
+You can pin either `bootstrap.js` or `bootstrap.min.js` in `config/importmap.rb`
+as well as `popper.js`:
+
+```ruby
+pin "bootstrap", to: "bootstrap.min.js", preload: true
+pin "@popperjs/core", to: "popper.js", preload: true
+```
+
+Whichever files you pin will need to be added to `config.assets.precompile`:
+
+```ruby
+# config/initializers/assets.rb
+Rails.application.config.assets.precompile += %w(bootstrap.min.js popper.js)
+```
+
+#### Sprockets
+
Add Bootstrap dependencies and Bootstrap to your `application.js`:
```js