BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News JS Foundation Announces Dojo 2.0 Release

JS Foundation Announces Dojo 2.0 Release

This item in japanese

Bookmarks

On May 2, 2018, the Dojo team released version 2 of Dojo, a JavaScript toolkit that helps developers scale their development process. This is a complete rewrite of Dojo, and focuses on how developers would want to build a modern enterprise application since the initial Dojo 1 release in 2007. Dojo 2 is built using TypeScript and embraces a component-based architecture and virtual DOM. It includes a wide range of tooling improvements, including a new CLI, integrated testing, and utilities for connecting Dojo to popular standards and utilities.

This release of Dojo is focused on taking the massive advances in modern JavaScript and making them more accessible. Dylan Schiemann, co-founder and project lead of Dojo, described it this way:

In many ways Dojo 1 had to be ahead of the times, whereas today the problem is more how do I put things together in a consistent way. How do I create something that is reactive like React, but scales better to larger components, or how do I have internationalization be something that feels natural instead of tacked on.
We’re trying to break down the barrier between frameworks. One thing we’ve been doing is - the web component system is heavily inspired by the Dojo 1 widget system. So what we’ve said is, we want a reactive component-based system, but we don’t want you to be locked into Dojo. So we have a set of tooling that can import or export web components for use within Dojo, or use outside of Dojo.

Tooling is a big emphasis in the Dojo 2 release, with a brand new CLI, integrated testing, and a range of utilities for connecting Dojo to popular standards and utilities. In a blog post about the upcoming release, Dojo 2 beta tester Rene Rubalcava highlighted how easy it is to export from a Dojo widget to a portable, standards-compliant web component: "In the repo run the command dojo build --element=src/createTwitterShareElement.ts and you can now use this component in your web page". When asked about his favorite features encountered during beta testing, Rubalcalva explained further:

The widget export could be a great entry point for folks to start using Dojo 2 right away. It is an awesome feature! I hadn’t seen that out of a framework before, and I think users are going to get a huge kick out of that - now you can create very focused components.
The CLI is really great. It’s got some great features in there - one that people are going to find a lot of use out of is the ability to theme your application with the CLI. You can bring in some of the default widgets that Dojo provides, and the CLI has tooling for applying theming to those widgets as well as your application.

Dojo includes a built-in theming system based on CSS Modules. All built-in widgets are themeable, and according to the theming documentation extending themes is straightforward using the CSS Module composition feature. Developers looking to get started with creating themes can check out a dedicated tutorial on the subject.

Earlier versions of Dojo had been criticized for poor documentation, so with this release it has been a huge focus for the core team. Said Schiemann:

Nothing lands in master until it’s tested and documented in a nice way. We take a holistic view of how people learn and try to document things in that way. We’ve started out with a nice tutorial series on the Dojo website that covers the first 50-100 things people would want to do.

Interested developers can start with the tutorials, explore a cookbook of common problems and solutions, or dive straight into the documentation.

Developers familiar with React may find Dojo 2 relatively straightforward to pick up. When asked to compare Dojo to other modern JavaScript Frameworks, Schiemann stated that Dojo is most similar to React, but where React follows a philosophy of allowing developers to make choices for every part of their stack, Dojo 2 has an opinionated set of defaults for every portion of the frontend application. Rubalcava went further:

React is a great library, great UI framework, and it’s very flexible. When working on teams, that same flexibility can make it tough to onboard people. With Dojo 2 they have a very similar virtual DOM experience, it does support JSX, but when it comes to working with a team environment the fact that everything is encapsulated makes it easy to bring new team members on.

Dojo 2 is an open source project supported by the JS Foundation, an organization that also supports key JavaScript projects like jQuery, webpack, and lodash with legal and governance support. Developers interested in getting involved with the development of Dojo can find contribution guidelines on Github, or interact with the team and community on the Dojo Gitter channel.

Rate this Article

Adoption
Style

BT