npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

grunt-html2jsx

1.0.5

@hemanth

npmHomeRepoSnykSocket
Downloads:182
$ npm install grunt-html2jsx
DailyWeeklyMonthlyYearly

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