3

I just started using Vue.js, but not sure how to add Boostrap package without using jQuery. I don't want to mix jQuery and Vue.js, so I decided to write my own JS code for triggering modal dialog (e.g.).

This is my prefered package:

npm install [email protected]

Currently, the app returns an error (jQuery is required), and I know that installing jQuery and adding it in webpack config would fix the problem, but as I said, I'd like to avoid jQuery.

Yes, I know that there's boostrap-vue, but I'm not interested into that too.

Thanks, N.

4
  • You simply cannot use Bootstrap without jQuery. What's the problem with including it? Commented Sep 19, 2017 at 0:38
  • @Phil I don't want to mix jQuery and Vue.js. I could also add React, Angula, Ember and so on.. I found interesting discussion here: github.com/twbs/bootstrap/issues/23204 It looks that jQuery will be rewritten with vanilla JS, but not so fast. Anyway, I could fork Bootstrap and remove dependencies. Just curious if there's other solution.. Commented Sep 19, 2017 at 0:54
  • 1
    Bootstrap JS is primarily a bunch of jQuery plugins so no, there is not another way (without using a Bootstrap clone like bootstrap-vue). Again, what's the problem with including jQuery? It will not conflict with Vue. They solve separate problems Commented Sep 19, 2017 at 0:56
  • 1
    Bootstrap is dependent on jQuery. Just don't use jQuery in your code? Commented Sep 19, 2017 at 2:37

1 Answer 1

2

You can

yarn add bootstrap@4 or npm install bootstrap@4 --save

Then in .scss

@import '~bootstrap/dist/css/bootstrap.min.css';

or in .js

import 'bootstrap/dist/css/bootstrap.min.css';

This will include css only (things like modal transitions will need custom implementation).

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.