Book Image

The Majesty Of Vue.js

By : Alex Kyriakidis, Kostas Maniatis
Book Image

The Majesty Of Vue.js

By: Alex Kyriakidis, Kostas Maniatis

Overview of this book

<p>Vue.js is a library to build interactive web interfaces. The aim is to provide the benefits of reactive data binding and composable view components with an API that is as simple as possible.</p> <p>This book will teach you how to efficiently implement Vue.js in your projects. It starts with the fundamentals of Vue.js to building large-scale applications. You will find out what components, filters, methods, and computed properties are and how to use them to build robust applications.</p> <p>Further on, you will become familiar with ES6, single file components, module bundlers, and workflow automation. The best way to learn to code is to write it, so there’s an exercise at the end of most of the chapters for you to solve and actually test yourself on what you have learned. You can solve these in order to gain a better understanding of Vue.js.</p> <p>By the end of this book, you will be able to create fast front-end applications and increase the performance of your existing projects with Vue.js integration.</p>
Table of Contents (23 chapters)
The Majesty of Vue.js
Credits
About the Authors
www.PacktPub.com
Preface
2
Getting Started
8
Consuming an API – Preface
12
ECMAScript 6
15
Swapping Components
18
Closing Thoughts

Chapter 14. Mastering Single File Components

As we promised, in this chapter we are going to review single file components. To build these single file Vue components we need tools like Webpack with vue-loader, or Browserify with vueify. For our examples, we are going to use Webpack, which we've already seen how it works. If you prefer Browserify or something else, feel free to use it.

Single file components or Vue components allow us to specify a template, a script, and style rules, all in one file using *.vue extension. So, each component encapsulates its CSS styles, template, and JavaScript code, in the same place. And that's were Webpack steps in, to bundle this new type of files with the others.

In addition, we need vue-loader (https://github.com/vuejs/vue-loader) to transform Vue components into plain JavaScript modules. vue-loader is a loader for Webpack that also provides a very nice set of features, such as ES2015 enabled by default, scoped CSS for each component, and more.