1

I have read that including jQuery inside Vue project is not advisable https://vuejsdevelopers.com/2017/05/20/vue-js-safely-jquery-plugin/

But if I include specific plugin for each task then those plugin have common code each in their own codebase. For example let's say finding some element by complex selector. This is already supported in jQuery so if I use jQuery plugin the plugin would be using jQuery's centralised code but if I use vanilla JS plugins each plugins would have their own code and may be duplicated across several plugins which would ultimately increase my JavaScript file size.

I wanted to know what is the best practise for Vue project - go with vanilla JS plugins or use jQuery and it's plugins whilst creating components for it. I am quiet confused.

It is early days since my project has started and I want to know what is the best way to include plugins? Should I include jQuery plugins in my Vue project or should I use vanilla plugins doesn't matter if most of them have duplicate code inside their plugin.

1 Answer 1

3

I have read that including jQuery inside Vue project is not advisable

Vue-like frameworks - which make extensive use of data-binding - don't typically need frameworks like jQuery.

The whole point of these kind of frameworks is that they build the HTML view for you based on the bound data.

This is in contrast with jQuery-only projects where you need to manually build the HTML view yourself with the help of jQuery.

I'm pretty sure that when you get the hang of how Vue works, you won't need jQuery - and in the cases you do, the DOM API will mostly have you covered.

Should I include jQuery plugins in my Vue project or should I use vanilla plugins doesn't matter if most of them have duplicate code inside their plugin?

Prefer using Vue plugins where possible. If there's a jQuery plugin that you absolutely need to use, then go for it and include jQuery.

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.