Single-file components

We know from the old best practices that it is always good to separate HTML from CSS and JavaScript files. Some modern frameworks such as React are relaxing and gradually wiping out this rule. Nowadays, you will not be shocked by looking at the small file or the component that contains its own markup, style, and application code inside it. Actually, for small components, we even find it more convenient to have such architecture. Vue also allows defining everything related to the same component in the same file. This kind of component is known as a single-file component.

Note

A single-file Vue component is a file with a .vue extension. The application that contains such components can be built using the webpack vue configuration. ...

Get Learning Vue.js 2 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.