-
Notifications
You must be signed in to change notification settings - Fork 97
why does rails new Xyz --css=bootstrap --js=esbuild
not produce working (JS) bootstrap?
#113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
rails new Xyz --css=bootstrap --js=esbuild
not produce working bootstrap?rails new Xyz --css=bootstrap --js=esbuild
not produce working (JS) bootstrap?
I can see based on tutorials on the internet and also based on the wrong answers on this SO post https://stackoverflow.com/questions/71216446/bootstrap-5-1-not-working-in-jsbundling-rails-7 that perhaps this was working once about a year ago? |
I also tested against Rails 7.0.0 and got the same result. I do not see why others seem to get a different result here,I tried this on two separate machines using Ruby 3.1.3 and Node 16.17.1 |
|
Can't replicate when using Bootstrap 5.0 example code from here: https://getbootstrap.com/docs/5.0/components/navbar/ Works out of the box with Looks like the problem is that your HTML contains data attributes not recognized by Bootstrap 5.0. You have:
You need:
|
Confirmed--- I was using the example navbar code from Bootstrap 4. My mistake. Thank you @dhh |
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce:
rails new Xyz --css=bootstrap --js=esbuild
generate default controller
app/views/welcome/index.erb
add this basic Navbar:./bin/dev
result:

Javascript interactions do not work
expected result:

When I click on the drop-down, the submenu is exposed (JS interactions work)
Sample app (broken, following steps above):
https://github.com/jasonfb/BootstrapTest2
TO BUILD A CORRECTLY WORKING BOOTSTRAP APP STARTING WITH ESBUILD, FOLLOW THESE INSTRUCTIONS
rails new HelloWorld --javascript=esbuild
then adding
bundle add "sassc-rails"
add
css: yarn build:css --watch
to Procfile.devyarn add @popperjs/core bootstrap bootstrap-icons sass
In package.json, add to the “scripts” section the bold line:
IN APP/ASSETS/CONFIG/MANIFEST.JS, REMOVE THIS LINE:
DELETE THE FILE AT APP/ASSETS/STYLESHEETS/APPLICATION.CSS AND REPLACE IT WITH A FILE APP/ASSETS/STYLESHEETS/APPLICATION.SCSS
THEN TO APP/JAVASCRIPT/APPLICATION.JS (YOUR ESBUILD PACK FILE), ADD:
TO CONFIG/INITIALIZERS/ASSETS.RB, ADD THIS LINE:
Sample app (working):
https://github.com/jasonfb/BootstrapTest3
What is strange to me is that examining my two apps (BootstrapTest2 and BootstrapTest3) I can't see what the difference is why it is working in BootstrapTest3 and not BootstrapTest2
The text was updated successfully, but these errors were encountered: