How to use “grunt-react” #2
Collaboration with grunt-browserify

Tweet about this on TwitterShare on Facebook0Share on LinkedIn0Share on Google+0

Browserify enables CommonJS syntax where module importing is available.

This post is an additional version of the previous “How to use “grunt-react” Auto translation from jsx to js“. The “grunt-react” plugin can be more useful & effective with Browserify. And a plugin called “grunt-browserify” is the great contributor!

Install

If you did not install “grunt-react”, please refer to the previous post here.

Grunt configuration

A value in options “tranform: transform: [ require('grunt-react').browserify ]” imports grunt-react config.

JS

Only with grunt-react

For grunt-react config, please refer to the previous post.

Obviously, we need to read react.js prior to the above js file, otherwise the script fails to run.

With Browserify

Here employs react.js from bower (bower install react). You don’t need react.js line in html anymore!

Leave a Comment.