Why Components’ Data Properties Must Be Functions

May 2, 2017 by
Part 52 of 55 in the Vue.js: From Beginner to Professional series

I previously mentioned that with components, the data property must be a function and not an object as we are used to. I have opened up an example of a component which contains a button. <div id="app"> <counter></counter> </div> Vue.component(‘counter’, { template: ` <div> <button @click="counter++">{{ counter }}</button> </div> ` }); new Vue({ el: ‘#app’… read more

Building Vue.js Applications for Production

April 29, 2017 by
Part 50 of 55 in the Vue.js: From Beginner to Professional series

In this short post, I want to show you how to build the project for production. This involves hiding any development messages and warnings, and also minifying JavaScript. To make a build, simply run the below command, which is defined within the package.json file. npm run build When doing so, a production build of your… read more

Understanding the Project Structure

April 28, 2017 by
Part 48 of 55 in the Vue.js: From Beginner to Professional series

Alright, so now that we have set up our project, let’s actually see what it looks like. First, let’s open up the “package.json” file, which describes the project’s dependencies. { “name”: “sample-project”, “description”: “A Vue.js project”, “version”: “1.0.0”, “author”: “Bo Andersen “, “private”: true, “scripts”: { “dev”: “cross-env NODE_ENV=development webpack-dev-server –open –hot”, “build”: “cross-env NODE_ENV=production… read more