grunt-html2jsx

1.0.5 • Public • Published

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

/grunt-html2jsx/

    Package Sidebar

    Install

    npm i grunt-html2jsx

    Weekly Downloads

    7

    Version

    1.0.5

    License

    MIT

    Last publish

    Collaborators

    • hemanth