This is one of my favorite “features” of Vue. The system is built on straightforward JavaScript such that it works equally well in the simple, old way of just including a script tag and having all your code in the DOM, as it does with all the bells and whistles of modern build systems.
You can use a plain Vue object as a message bus, event emitter, or a simple reactive data container without any template or visual logic involved. It’s a damned useful primitive to add to your toolbox.
I’ve found that Vue’s documentation and api are clear, consistent, and well-reasoned. The core system is a set of primitives that cover about everything you would want in a web app, you can easily pick and choose just the pieces you want but they also work perfectly in the fashion of a much heavier framework if you decide to use them all together.
This is about the best open source project I’ve ever used. Highly recommended for anyone who is curious about it, and hats off to Evan You and the whole team for what they’ve built.
While this is certainly good to get started, it’s definitely worth transitioning to a build-based process if for no other reason that components ran through vue-loader or vueify gets precompiled into render functions, so you get both speed and file size savings. This is a great guide for those investigating different options or those not comfortable with Webpack though.
All our new front end stuff uses Vue.js now, and we’ve been very happy with it. No more unmaintable jQuery nightmares and much greater reusability, which goes even further when you throw renderless components into the mix.
It does have one or two rough spots; for example passing events up more than two levels gets messy quickly unless you use Vuex (sometimes overkill) or a global event bus (works but feels quite hacky), but by and large it’s a very nice library, and certainly seems easier to get started with than something like React.
Nicely done. This is a must read for anyone stuck in "manual DOM querying and manipulation land" with jQuery looking to level-up using Vue.js as an excellent alternative.
By the time I got to the 2nd code example in this article, I was already rolling my eyes at the old jQuery approach I used for years: "Wait, is it .val() or .text() to pull the "value" out of that element?"(1)
Web devs who give Vue.js a try have to come away with a smile on their face. Sure, they may prefer React or Angular for a variety of reasons, such as team size. But Vue.js just makes it so darn easy to get started. It definitely helps to "progressively" adopt modern, model-driven approaches to web apps.
I wouldn't mind a build tool if it didn't require a ton of JavaScript files (looking at you Babel.js).
Recently I had to start a new project and decided to use Go for the back-end and Vue.js for the front-end, but I was concerned about all the tooling that I would need to integrate just to power the front-end side of the website. More so considering that my employer's business has nothing to do with web development so all this overhead would be unjustifiable. I spent several days reading and trying to understand what every tool included by Babel.js was doing until I gave up after the +20th module. It felt like a nightmare to see the gigantic dependency tree inside the "node_modules" folder.
I felt relieved when I found that Vue.js Components don't need to be compiled [1].
I also found this article interesting [2] with information on different approaches.
I already tried it, but it also depends on Babel.js [1].
Here is the dependency tree upon installation [2] 144M in total.
I just created a fresh project with it, and the directory is now 134M and I just selected Eslint + Prettier for linting and formatting. I don't want to know how big the project would be if I were to choose the other available options (Router, Vuex, Babel, etc). This week I spent 1-2 hours designing a lightweight project structure to use Vue.js components without the build tool, it worked pretty well and it does what I need it to do, which is simply DOM binding, Ajax requests, and minimal templating because the rest is already handled by the back-end in Go.
> But you don’t have to commit or deploy the dependencies right?
Yes, I have, otherwise I will impose Node.js + NPM as a dependency for my co-workers who — again — are not web developers, they just want to quickly modify one or two things and deploy without my involvement, so I have to build something as standalone as possible, this means (in this and other projects) that I have to commit the whole "node_modules" folder with the rest of the files.
And if anyone thinks this is a weird requirement, I can tell you that last year I did some contractor work in four web agencies in San Francisco, and they all had a policy of "commit all the dependencies" because they wanted to "lock" the files to a specific version. They used to lock the dependencies using the "package.json" file, but after all the recent fiascos with NPM and their registry, they stopping relying on the constant download of these files during every deployment, something that we were considering even before the problems with NPM because downloading +200M of files for every execution of the test suite in the CI server was posing a significant cost for not reason.
If NPM and their registry were more stable, I would just put everything in the "package.json" file and ignore the +100M of code in the dependency tree, but unfortunately, the Node.js is voting for a different philosophy that has been biting them for several years now, they still haven't learnt the lesson.
Committing your node_modules folder is definitely a bad idea. To me, the right answer is to use Yarn's "offline mirror" feature to cache the package tarballs themselves in your repo. They're smaller, it's a lot fewer files, and it's platform independent.
I won’t knock anyone that does that, especially short term, since vendoring your libraries prevents build time dependencies outside of your control. But long term it might be worth looking at the NPM registry proxies that are out there.
JQuery is often used in popular front end components, like carousels and menus.
How do you approach something like slickjs? Or SmartMenus? Both of these are quite polished, with well thought-out APIs, and have solved for hundreds of issues and corner cases.
I’m not sure that it would be wise to go for a DIY solution in such cases.
I've always just looked for one that doesn't use jQuery. Haven't had trouble finding one for at least a year. Nowadays I always find there's already a Vue component that's a wrapper for whatever library.
VueJS has a few carousel libraries. Most are pretty good, although I also assume that the one you mentioned is ~5 years older (therefore more mature). Typically the issue is usually picking one that works with your CSS framework or learning for the first time how to wrap a vanillajs library in a Vue component definition. Bootstrap 4 and Bulma have great libraries that implement their features (e.g. tabs, drop-down menus, navs, etc.).
19 comments
[ 4.5 ms ] story [ 77.8 ms ] threadYou can use a plain Vue object as a message bus, event emitter, or a simple reactive data container without any template or visual logic involved. It’s a damned useful primitive to add to your toolbox.
I’ve found that Vue’s documentation and api are clear, consistent, and well-reasoned. The core system is a set of primitives that cover about everything you would want in a web app, you can easily pick and choose just the pieces you want but they also work perfectly in the fashion of a much heavier framework if you decide to use them all together.
This is about the best open source project I’ve ever used. Highly recommended for anyone who is curious about it, and hats off to Evan You and the whole team for what they’ve built.
I know right ? Everytime I have a question, I just keep reading, and it's right in the next parts. It feels like getting in a tutorial with a friend.
All our new front end stuff uses Vue.js now, and we’ve been very happy with it. No more unmaintable jQuery nightmares and much greater reusability, which goes even further when you throw renderless components into the mix.
It does have one or two rough spots; for example passing events up more than two levels gets messy quickly unless you use Vuex (sometimes overkill) or a global event bus (works but feels quite hacky), but by and large it’s a very nice library, and certainly seems easier to get started with than something like React.
By the time I got to the 2nd code example in this article, I was already rolling my eyes at the old jQuery approach I used for years: "Wait, is it .val() or .text() to pull the "value" out of that element?"(1)
Web devs who give Vue.js a try have to come away with a smile on their face. Sure, they may prefer React or Angular for a variety of reasons, such as team size. But Vue.js just makes it so darn easy to get started. It definitely helps to "progressively" adopt modern, model-driven approaches to web apps.
(1) https://stackoverflow.com/questions/807867/difference-betwee...
Recently I had to start a new project and decided to use Go for the back-end and Vue.js for the front-end, but I was concerned about all the tooling that I would need to integrate just to power the front-end side of the website. More so considering that my employer's business has nothing to do with web development so all this overhead would be unjustifiable. I spent several days reading and trying to understand what every tool included by Babel.js was doing until I gave up after the +20th module. It felt like a nightmare to see the gigantic dependency tree inside the "node_modules" folder.
I felt relieved when I found that Vue.js Components don't need to be compiled [1].
I also found this article interesting [2] with information on different approaches.
This is what I ended up with (my own design):
Where "app.min.js" contains the basic Vue.js options like this: And the sub-sequent pages, like "About", load a JavaScript file with this: [1] https://vuejs.org/v2/guide/components.html[2] https://medium.com/js-dojo/7-ways-to-define-a-component-temp...
Here is the dependency tree upon installation [2] 144M in total.
I just created a fresh project with it, and the directory is now 134M and I just selected Eslint + Prettier for linting and formatting. I don't want to know how big the project would be if I were to choose the other available options (Router, Vuex, Babel, etc). This week I spent 1-2 hours designing a lightweight project structure to use Vue.js components without the build tool, it worked pretty well and it does what I need it to do, which is simply DOM binding, Ajax requests, and minimal templating because the rest is already handled by the back-end in Go.
[1] https://github.com/vuejs/vue-cli/blob/3193b0d/package.json#L...
[2] https://pastebin.com/raw/x3kJ91xP
Yes, I have, otherwise I will impose Node.js + NPM as a dependency for my co-workers who — again — are not web developers, they just want to quickly modify one or two things and deploy without my involvement, so I have to build something as standalone as possible, this means (in this and other projects) that I have to commit the whole "node_modules" folder with the rest of the files.
And if anyone thinks this is a weird requirement, I can tell you that last year I did some contractor work in four web agencies in San Francisco, and they all had a policy of "commit all the dependencies" because they wanted to "lock" the files to a specific version. They used to lock the dependencies using the "package.json" file, but after all the recent fiascos with NPM and their registry, they stopping relying on the constant download of these files during every deployment, something that we were considering even before the problems with NPM because downloading +200M of files for every execution of the test suite in the CI server was posing a significant cost for not reason.
If NPM and their registry were more stable, I would just put everything in the "package.json" file and ignore the +100M of code in the dependency tree, but unfortunately, the Node.js is voting for a different philosophy that has been biting them for several years now, they still haven't learnt the lesson.
How do you approach something like slickjs? Or SmartMenus? Both of these are quite polished, with well thought-out APIs, and have solved for hundreds of issues and corner cases.
I’m not sure that it would be wise to go for a DIY solution in such cases.
What’s your experience?
Sounds like the next iteration of Backbone / Ember / etc frameworks.
Vs
React and Angular2 = Dom Diffing.
• ReactJS vs Angular5 vs Vue.js — What to choose in 2018? [2]
• Angular 5 vs. React vs. Vue [3]
• Angular vs. React vs. Vue: A 2017 comparison [4]
[1] https://vuejs.org/v2/guide/comparison.html
[2] https://medium.com/@TechMagic/reactjs-vs-angular5-vs-vue-js-...
[3] https://itnext.io/angular-5-vs-react-vs-vue-6b976a3f9172
[4] https://medium.com/unicorn-supplies/angular-vs-react-vs-vue-...