rails / cssbundling-rails

Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.
MIT License
565 stars 83 forks source link

JavaScript not working for Bootstrap 5 on Rails 7 #66

Closed umk1 closed 2 years ago

umk1 commented 2 years ago

Hello, I have started learning Ruby on Rails recently. I tried to install Bootstrap 5 with Rails 7 using this gem. The bootstrap framework is installed, but JavaScript is not working and no dropdown menu is displayed. I tried with Navbar sample code from bootstrap website (https://getbootstrap.com/docs/5.1/components/navbar/ ), but drop-down in the Navbar does not work. Tried on Firefox browser and Google Chrome.

I did installation exactly as per instructions.

  1. Added cssbundling-rails to Gemfile with gem 'cssbundling-rails'
  2. Run $bundle install
  3. Run $rails css:install:bootstrap

Google Chrome terminal gives this error. Uncaught TypeError: Failed to resolve module specifier "bootstrap". Relative references must start with either "/", "./", or "../".

Screenshot from 2022-01-15 20-42-56

Thanks.

dhh commented 2 years ago

Sounds like you'll probably need jsbundling-rails the way you're going with JavaScript. Have a look here: https://github.com/rails/jsbundling-rails/

ghost commented 2 years ago

Even after installing jsbundling-rails, components like navbar aren't working.