sindresorhus/gulp-react

语言: JavaScript

git: https://github.com/sindresorhus/gulp-react

[DEPRECATED]预编译Facebook将JSX模板反射到JavaScript中
[DEPRECATED] Precompile Facebook React JSX templates into JavaScript
README.md (中文)

吞掉反应的

贬低赞成gulp-babel。阅读更多。

将React JSX模板预编译为JavaScript

应在React问题跟踪器上报告输出问题。

安装

$ npm install --save-dev gulp-react

用法

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

gulp.task('default', function () {
    return gulp.src('template.jsx')
        .pipe(react())
        .pipe(gulp.dest('dist'));
});

API

反应([选项])

请参阅react- tools选项,但sourceMap和sourceFilename除外,它们是为您处理的。

来源地图

像这样使用gulp-sourcemaps:

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

gulp.task('default', function () {
    return gulp.src('template.jsx')
        .pipe(sourcemaps.init())
        .pipe(react())
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('dist'));
});

执照

与©Sindre Sorhus

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

gulp-react Build Status

Deprecated in favor of gulp-babel. Read more.

Precompile React JSX templates into JavaScript

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

Install

$ npm install --save-dev gulp-react

Usage

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

gulp.task('default', function () {
    return gulp.src('template.jsx')
        .pipe(react())
        .pipe(gulp.dest('dist'));
});

API

react([options])

See the react-tools options, except for sourceMap and sourceFilename, which are handled for you.

Source Maps

Use gulp-sourcemaps like this:

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

gulp.task('default', function () {
    return gulp.src('template.jsx')
        .pipe(sourcemaps.init())
        .pipe(react())
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('dist'));
});

License

MIT © Sindre Sorhus