Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.09 KB

File metadata and controls

41 lines (31 loc) · 1.09 KB

gulp-render-react Build Status

Render React components to string or static markup

Will render React component with React.renderToString or React.renderToStaticMarkup

Install

$ npm install --save-dev gulp-render-react

Usage

var gulp = require('gulp');
var render = require('gulp-render-react');

var SRC = 'src/*.jsx';
var DEST = 'dist';

gulp.task('default', function () {
  return gulp.src(SRC, { read: false })
    .pipe(render('string', {
      some: 'default'
      props: 'to',
      pass: 'on'
    }))
    .pipe(gulp.dest(DEST));
});

API

render(type, props)

  • type is
    • string for React.renderToString()
    • markup for React.renderToStaticMarkup()
  • props are the properties to create the component with

License

MIT © Andrew Shapro