0

In Rails 6.0 the application.js is in a new path /app/javascript/packs/ vs the old path app/assets/javascripts/.

I added these line the application.js file in the new path:

//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .

but after saving it I'm not seeing the expected bootstrap dropdown menu.

1
  • I believe you might be interested to read this tutorial Commented Nov 3, 2019 at 17:03

1 Answer 1

0

The above snippet works for pre 6.0 but this solution was provided to me by another person to work in rails 6.0 1) $ yarn add [email protected] [email protected]

2) add this to config/webpack/environment.js

const { environment } = require('@rails/webpacker')

const webpack = require('webpack')
environment.plugins.prepend('Provide',
  new webpack.ProvidePlugin({
    $: 'jquery/src/jquery',
    jQuery: 'jquery/src/jquery'
  })
)

3) add this app/javascript/packs/application.js

require("jquery")
import "bootstrap"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.