gulp-html2react

0.1.6 • Public • Published

gulp-html2react

Compile html to React syntax.

Inspired by gulp-react

Motivation

I don't like write html in js file,so i build this gulp.

Install

$ npm install --save-dev gulp-html2react

Usage

var gulp = require('gulp');
var html2react = require('gulp-html2react');
 
gulp.task('react', function() {
    return gulp.src('app/javascripts/templates/*.html')
        //compile html to JavaScript in React syntax.
        .pipe(html2react())
        .pipe(gulp.dest('temp/javascripts/templates'));
});

Custom Element

If you use custom element in html:

<div>
    <HelloMessage name="John" />
</div>

You Must add require path about the custom element component:

<!-- var HelloMessage = require('.././components/hello_message'); -->
<div>
    <HelloMessage name="John" />
</div>

License

MIT © ocowchun

Readme

Keywords

Package Sidebar

Install

npm i gulp-html2react

Weekly Downloads

1

Version

0.1.6

License

MIT

Last publish

Collaborators

  • ocowchun