Should You Be Using the Vue CLI?


Vue.jsThe Vue team has been working hard. Much like Angular, the Vue team has a command-line interface (CLI) to help develop projects with Vue.

If all you're doing is building a SPA, the CLI can really help simplify setting up a project. But is that all you should be doing with Vue?

In my Vue course and talks, I've been advocating that Vue is a good middleground between the philosophies of Angular and vanilla JavaScript. Not every project is a Single Page Application (or multi-page application if you prefer). In this way, I really like how Vue can be scaled up as necessary. In my mind this means that there is a use-case for using Vue without the complexities of a JavaScript build step.

What I mean is that I can start an interactive page as simply as adding vue.js and writing some simple JavaScript:

  // <script src="vue.js"></script>
  var view = new Vue({
    el: "#myDiv",
    data: {
      name: "Shawn"  
    },
    methods: {
      save: function () { alert("don't use alerts"; }
    }
  });

As this scales up to use routing, vuex, and composition, I can add TypeScript or Babel, Webpack or Browserfy, and Linting. But for a simple case, it might not be advantageous to use all that complexity.

But what if you know you're building something big? You've decided that Vue is the right solution for a larger project? What if you wanted to use some Webpack only features (e.g. Single Page Components)? Being able to scaffold the build step complexity would be great, no?

If you haven't played with the Vue CLI, let me describe it very briefly. The Vue CLI is similar to the Angular CLI in that it hides the complexity of having to know how babel or webpack work. It's pluggable so you can decide when you start to use TypeScript, Babel, Unit Testing, etc. It also allows you to use the CLI to run builds, watch for build changes or even just serve an HTML file to development.

For my use this means I really only do a couple of things with it. I create new projects with the vue new functionality. And I use the project.json intergration to build my projects.

So to answer my own question, "Should You Be Using the Vue CLI"? It depends. I think the use-case of building up incrementally for smaller-use cases is the right way to do it. But if you're building a large-scale project, Vue CLI can certainly simplify starting a project and building it.

If you haven't looked at the CLI yet, take a look:

Vue CLI

If you've already bought my Vue Course, I'll be adding a new CLI chapter in the next couple of weeks for free. Look for the announcement here or through your email!


Ready to Learn Vue with ASP.NET Core?

Shawn's 4-hour course will get you up to speed in no time. Vue.js is a great middle-ground between React and Angular for people who don't like the complexity of Angular, and the overly componentized React. Learn today at Wilder Minds Training!

Enroll Today


Shawn
Shawn Wildermuth
Author, Teacher, and Coach




My Courses

Wilder Minds Training
Vue.js by Example (Now Available)
Bootstrap 4 by Example
Intro to Font Awesome 5 (Free Course)
Pluralsight
Less: Getting Started (Coupon Available)
Building a Web App with ASP.NET Core, MVC6, EF Core, Bootstrap and Angular (updated for 2.1)
Using Visual Studio Code for ASP.NET Core Projects
Implementing ASP.NET Web API
Web API Design

Application Name WilderBlog Environment Name Production
Application Ver v4.0.30319 Runtime Framework x86
App Path D:\home\site\wwwroot\ Runtime Version .NET Core 4.6.27019.06
Operating System Microsoft Windows 10.0.14393 Runtime Arch X86