Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Rewritten Framework for Vue.js 2.0 Release

Rewritten Framework for Vue.js 2.0 Release

The team behind Vue.js has released v2.0, in what is described as a "full rewrite" of the framework.

Creator Evan You describes Vue as consisting of "a core view layer and accompanying tools and supporting libraries," and says that the 2.0 release makes it both leaner and faster.

"The rendering layer is now based on a lightweight virtual-DOM implementation that improves initial rendering speed and memory consumption by up to 2~4x in most scenarios," You says.

Further to this, developers can separate the template-to-virtual-DOM compiler and the runtime, allowing for pre-compiled templates, and shipping apps with only the runtime. Vue boasts this is less than 12kb min+gzip, compared to 44kb min+gzip for React 15.

You says that Vue also applies "some advanced optimisations during the template-to-virtual-DOM compilation phase," including "detecting static class names and attributes" that aren't diffed after the initial render.

In the official blog post Announcing Vue.js 2.0 You says that despite 2.0 being a full rewrite "the API is largely compatible with 1.0 with the exception of some intentional deprecations." Most notable of these are several changes to the filter system.

From 2.0, Filters can now only be used inside text interpolations ({{}} tags), with You explaining the team had found filters with directives including v-model and v-on "led to more complexity than convenience."

Furthermore, Vue 2.0 will ship without any built-in filters, and it is recommended that developers use standalone libraries such as moment.js for formatting dates and accounting.js for currencies. The final change to filters is a change to syntax, to bring it inline with JavaScript function invocation {{ date | formatDate('YY-MM-DD') }}.

Vue 2.0 is currently a public preview, with a Beta expected to follow in June, and reactions to the preview have been largely positive.

Systems analyst Victor Bastos commented that he was "Sad about filters deprecation," mentioning it was one of his "preferred things in Vue." Not everybody echoed Bastos' opinion. Educator Chris Fritz replied "I was personally in favor of removing filters because they really are just JavaScript functions, but are used with a special pipe syntax that suggests some kind of magic is going on. For me, that’s another barrier to entry for beginners to the library."

Vue.js is an MIT-licensed open source project. InfoQ readers interested in contributing to the project should first read the contributing guide.

Rate this Article