Skip to content

parroit/gulp-jsxify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

gulp-jsxify Build Status

Precompile HTML templates into Facebook React JSX

Issues with the output should be reported on the React issue tracker.

You'll find an introductory blog post here

Install

$ npm install --save-dev gulp-jsxify

Usage

var gulp = require('gulp');
var jsxify = require('gulp-jsxify');

gulp.task('default', function() {
    
    return gulp.src('template.html')
        .pipe(jsxify({
            requires:{
                AnotherWidget: './another-widget'
            }
        }))
        .pipe(gulp.dest('./jsx-files'));
});

Templates content is wrapped with the following code:

/** @jsx React.DOM */
'use strict';

//here we add requires as defined below
            
module.exports = function(args){ 
            return (
                    //here we add template content
            
            );
};

API

jsxify(options)

options.requires

Type: object
Default: {React: 'react'}

Define a set of React widget required by your templates. React dependency is inserted by defaqult if not present.

Relative requirements must be relative to the folder where gulp.dest() final js files

License

MIT © Andrea Parodi

About

gulp plugin to convert html files to react jsx

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published