Home

Awesome

gulp-react Build Status

Converts HTML to JSX for use with React.

Install

$ npm install --save-dev gulp-html2jsx

Usage

var gulp = require('gulp');
var html2jsx = require('gulp-html2jsx');

gulp.task('default', function () {
	return gulp.src('template.html')
		.pipe(html2jsx({/* if any opts */}))
		.pipe(gulp.dest('dist'));
});

API

html2jsx(options)

options:

{
  createClass: true,
  outputClassName: 'AwesomeComponent'
}

Sample:

<p> Hello </p>

Get converted to:

var NewComponent = React.createClass({
  render: function() {
    return (

      <p> Hello </p>
    );
  }
});

License

MIT © Hemanth.HM