Installing https://github.com/twbs/bootstrap-rubygem on rails 6 alpha

Viewed 1513

How do you install the bootstrap gem (https://github.com/twbs/bootstrap-rubygem) on rails 6?

The bootstrap README asks us to add things to application.js but rails 6 doesn't seem to have an application.js in the usual place.

[ Rails 6.0.0.alpha ] bundle exec rails new noname --edge --database=postgresql --webpacker=react

2 Answers

This is the most basic solution for me:

Install bootstrap, jquery and popper.js with yarn:

$ yarn add bootstrap
$ yarn add jquery
$ yarn add popper.js

Then require bootstrap JS and CSS in app/javascript/packs/application.js:

require('bootstrap')
require('bootstrap/dist/css/bootstrap.min.css')

Note: If you need to use SCSS to customize Bootstrap then this solution is not proper for you. Use @coorasse's solution above.

Related