Skip to content

hemanth/grunt-html2jsx

Repository files navigation

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

About

Converts HTML to JSX for use with React.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •