1.0.5 • Published 8 years ago

grunt-html2jsx v1.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

grunt-html2jsx Build Status

Converts HTML to JSX for use with React.

Install

$ npm install --save-dev grunt-htmltojsx

Usage

require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks

grunt.initConfig({
	htmltojsx: {
		options: {
			includeRuntime: true
		},
		dist: {
			files: {
				'dist/main.js': 'src/main.js'
			}
		}
	}
});

grunt.registerTask('default', ['htmltojsx']);

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