Skip to main content
WordPress Support

WPTavern: Vue.js Creator Evan You Weighs in on WordPress JavaScript Framework Discussion

By 05/06/2017October 24th, 2017No Comments

WPTavern: Vue.js Creator Evan You Weighs in on WordPress JavaScript Framework Discussion
photo credit: JSConf China

Last week WordPress core contributors narrowed their considerations for a new JavaScript framework to React and Vue. As the core team has more collective knowledge of working with React, they have reached out to developers with different experiences of using other frameworks in a WordPress context.

One of the chief concerns contributors have regarding Vue is the longevity of the project. I asked Vue creator Evan You if he could weigh in on the topic to give WordPress contributors a better understanding of the project, specifically regarding his efforts to cultivate additional maintainers to help share the load of maintainership.

“I think it’s important to look at the track record – Vue has been around for almost 4 years, and all the work has been done in public on GitHub so anyone can go and check the maintenance history,” You said. “While it has been largely developed by me, the current maintenance is a lot more community-driven. We have active core team members triaging most of the issues and a larger and larger percentage of the issues fixed by community PRs. So – yes, I had already been working on cultivating additional maintainers and will continue to do so.”

You currently receives $10K/month from recurring Patreon donations that fund his full-time efforts working on Vue. Prior to this he also worked at Google and Meteor. During his time at Google, some of the projects You worked on used Angular, which he said he found to be too heavy for his use cases at the time. He built Vue.js to be a more lightweight implementation of the concepts that he liked about Angular.

You also recently said he has learned quite a bit from the React community, which has influenced some of his technical decisions in Vue 2.

“First, Vue 2 uses the same Virtual DOM based rendering model underneath, which was first pioneered by React,” You said. “Introducing a Virtual DOM allowed Vue to expose the power of vdom composition while maintaining the approachability.

“The React community is also very active when there are new problem domains being explored – e.g. state management and CSS management. There are many competing solutions and a lot of inspirations when I was implementing official solutions for Vue.”

Evan You Addresses WordPress Core Contributors’ Misconceptions about Vue.js

You said he has been following WordPress contributors’ discussions on React vs Vue but would not offer an opinion on which is a better choice for the project.

“My answer would obviously be biased, and honestly I’m not in the shoes of the WP core team so I don’t have enough perspective to make a choice,” You said. “However, I can provide feedback on some of the issues being discussed in hope of helping them make a better-informed decision.”

You left a comment on the most recent Javascript meeting notes with clarifications on a few misunderstandings about Vue.js. You addressed the point regarding “embracing JavaScript the language,” as some contributors think Vue’s templating language obscures the underlying JavaScript.

“I think ’embracing JavaScript the language’ is another primitive of React we don’t see in Vue,” Andrew Duthie said during the last meeting.

You’s reply compares Vue’s use of templates as “syntax sugar for view representation on top of HTML” to what he believes to be a similar usage in the case of JSX as view representation on top of JavaScript:

The increasing richness of UI does NOT necessitate putting everything in JavaScript. On the other hand, just because Vue uses templates by default doesn’t mean it allows people to get by without learning JavaScript properly.

Vue’s templates are compiled into JavaScript render functions under the hood and they are actually closer to JavaScript than to traditional string templating. It’s just a layer of syntax sugar on top of the underlying Virtual DOM representation. Think of JSX as syntax sugar for view representation on top of JS; Vue templates are syntax sugar for view representation on top of HTML.

JSX/Raw JS does provide more flexibility when you need to apply direct manipulation of Virtual DOM nodes, this is why Vue also supports render functions. But this is not putting two opposing paradigms under the same tent – it’s simply allowing the user to skip the syntax sugar layer for more control.

You said the idea behind templating on top of render functions is to provide “better approachability,” a concern shared by many other proponents of WordPress adopting Vue.

“Users who are more comfortable with HTML and have simpler use cases could use the template, while users who are already familiar of JSX/render functions can leverage the full power of JS,” You said. “This would fit pretty nicely for the use of WP core: community users who care about approachability have an easier time getting started, while the core team have access to JSX/render functions for advanced use cases.”

You also addressed the concern of longevity by offering more information on Vue’s development processes. He confirmed that the current codebase is largely developed by him alone, but maintenance is spread across a core team with members all over the world.

“Other contributors have lower commit counts because their contributions are all submitted in the form of PRs and we use the ‘Squash and commit’ feature on GitHub so each PR results in only one commit for the contributor,” You said. “We’ve merged close to 500 PRs in the core repo alone, and many more across the organization. Other repos under the vuejs organization, e.g. vuex, vue-router, are also largely maintained by dedicated team members.”

You also offered clarification on questions of stability and future compatibility, as WordPress contributors presented concerns regarding breaking changes in the templating language in Vue 2.0.

“This begs for some clarification: Vue versioning strictly follows semver,” You said. “The only time there had been breaking API changes post 1.0 was the 2.0 bump. The template syntax is part of the API so it’s not going to [break], and in between major version bumps we commit to 100% API backwards compatibility. We take stability very seriously, so do our community and in-production users, including GitLab, Vice, and some of the biggest internet companies in China.”

As many WordPress core contributors have been developing on top of React for years, You’s input offers a more detailed, in-depth look at Vue that contributors have been asking for during various rounds of feedback. The discussion will continue over the next several weeks and contributors plan to include the topic at WordCamp Europe’s contributor summit.

Source: WordPress

Leave a Reply