在 Rails 6 alpha 上安装 https://github.com/twbs/bootstrap-rubygem [英] Installing https://github.com/twbs/bootstrap-rubygem on rails 6 alpha
问题描述
如何安装 bootstrap gem (https://github.com/twbs/bootstrap-rubygem) 在导轨 6 上?
How do you install the bootstrap gem (https://github.com/twbs/bootstrap-rubygem) on rails 6?
引导自述文件要求我们向 application.js 添加内容但 Rails 6 似乎在通常的地方没有 application.js.
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
[ Rails 6.0.0.alpha ]
bundle exec rails new noname --edge --database=postgresql --webpacker=react
推荐答案
如果你使用webpacker,你可能想使用bootstrap的npm包
If you use webpacker, you may want to use the npm package of bootstrap
yarn add bootstrap@4.0.0 popper.js
和
# app/javascript/packs/application.js
import 'bootstrap/dist/js/bootstrap';
在 stylesheets.scss 中
and inside stylesheets.scss
@import '~bootstrap/scss/bootstrap';
请在此处查看完整步骤:https://medium.com/@coorasse/goodbye-sprockets-welcome-webpacker-3-0-ff877fb8fa79
Please look at the complete steps here: https://medium.com/@coorasse/goodbye-sprockets-welcome-webpacker-3-0-ff877fb8fa79
这篇关于在 Rails 6 alpha 上安装 https://github.com/twbs/bootstrap-rubygem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!