One month after the launch of Taro 1.1, over 500 submissions and 17 iterations of preview builds, we are confident that the official Taro 1.2 release can be released today.

Taro 1.2 adds many features first implemented in the applet framework over Taro 1.1 and other applet development frameworks. These features include, but are not limited to:

  • Wechat small program to multi-terminal application
  • Bytedance (Headline) applet support
  • CSS Modules support
  • MobX support

Wechat small program to multi-terminal application

$ taro convert
Copy the code

Taro will generate the converted code in the taroConvert folder in the root directory. The converted code is highly readable JSX code without the additional overhead of a large component library. You can easily do secondary development, or simply use the taro Build command to generate any application that Taro already supports.

We have successfully converted four of GitHub’s most popular open source wechat applets using Taro Convert, and they all performed well:

  • EastWorld/ weike-app-mall ★5000+ – wechat small app mall
  • Tumobi/Nideshop -mini- Program ★3000+ – open source wechat small program mall based on Node.js + MySQL development
  • RebeccaHanjw/ appellate
  • Jectychen/wechat – painted v2ex 400 + – v2ex

Taro Convert not only supports the conversion of wechat applet applications, it can also convert wechat applet third-party components. For example, wxParse, compiled with Taro Convert, is able to resolve only 11 levels of HTML nesting, which is theoretically unlimited.

More details can be accessed documents nervjs. Making. IO/taro/docs/t… Learn more.

Bytedance (Headline) applet support

# npm script
$ npm run dev:tt
$ npm run build:tt
# Global install only
$ taro build --type tt --watch
$ taro build --type tt
# NPX is also available to users
$ npx taro build --type tt --watch
$ npx taro build --type tt
Copy the code

To select Bytedance Applet mode, you need to download and open bytedance Applet developer tools, and then preview your project in the dist directory in the project root directory after compiling.

Accordingly, Taro’s platform logo (process.env.taro_env) has added a new member, TT, to stand for bytedance applets.

CSS Modules support

We’ve supported SCSS, LESS, and Stylus since Taro first opened source, and with Taro 1.2 we’ve taken it one step further by bringing JSX’s best friend to the community: CSS Modules.

Support for CSS Modules is of great significance to Taro. Taro already supports passing in JavaScript objects for component styles in 1.0, and CSS Modules can do the same for component classnames — which means that Taro can fully implement one of JSX’s features: “Everything in JavaScript”. At the same time, through the automatic completion and verification functions of the editor, developers no longer need to worry about CSS class errors and CSS class naming problems.

You can refer to the documentation using CSS Modules to find out how to enable CSS Modules.

Support for CSS Modules was developed primarily by an individual developer in the Taro community @mrKou47, thanks for his contributions.

MobX support

As applets become more complex, more and more developers are choosing to use independent state management tools. In Taro 1.1 you can choose from redux-Thunk, DVA-Core, Redux-Saga and other tools for Redux’s system. In Taro 1.2 we brought taro-Mobx.

Using MobX in Taro is easy, you can create a brand new MobX template project by using the Taro init

command. You can also check out the taro-MOBx documentation for connecting taro-MOBx to existing projects.

MobX support is primarily developed by the Taro community’s individual developer @Nanjingboy (Tom Huang), thanks for his contributions.

More features

The Taro official team has not been idle in the face of dedicated individual contributors in the community. While 169 issues were closed by commit during Taro 1.2 development, we also brought more features throughout the year. Among them, it is worth mentioning:

  • The H5 routing system is completely reconstructed
  • The props of the applet component supports passing in JSX elements
  • Support for JSX elements written inswitch-case, and supportif-elseswitch-caseMultiple nesting of
  • Support for reference aliases
  • Cooperated with baidu applet and Bytedance applet officials to smooth out a large wave of differences with wechat applet

You can view the complete feature iteration history on CHANGELOG.

Write in the last

One of the most exciting features of Taro 1.2 is the “Convert them to Taro” feature, which allows existing wechat apps to convert them to more maintainable Taro (React) code and convert them to multi-applications.

But more importantly, the two core feature points of this Taro 1.2 update are all contributed by individual developers — a complete reflection of the vibrant, robust, and open Taro community. We will also maintain long-term relationships with developers in the community, and grow with them to mutual benefit and mutual benefit. This is also the significance of Taro’s choice of open source.

If you have any ideas, or don’t have any, you’re welcome to visit them:

github.com/NervJS/taro