Skip to content

Instantly share code, notes, and snippets.

@esnya
Created May 13, 2015 17:08
Show Gist options
  • Save esnya/fe9ab1351cbf416207c7 to your computer and use it in GitHub Desktop.
Save esnya/fe9ab1351cbf416207c7 to your computer and use it in GitHub Desktop.
React with gulp
'use strict';
var gulp = require('gulp');
var react = require('gulp-react');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var browserfyConfig = {
entries: ['./js/index.js'],
standalone: 'app'
};
gulp.task('lib', function () {
return gulp.src('src/*.js')
.pipe(react({harmony: true}))
.pipe(gulp.dest('js'));
});
gulp.task('browserify', ['lib'], function () {
return browserify(browserfyConfig)
.bundle()
.pipe(source('app.js'))
.pipe(gulp.dest('./js/'));
});
gulp.task('build', ['lib', 'browserify']);
gulp.task('default', ['build']);
{
"name": "sw2",
"version": "0.0.0",
"description": "nekosheet-sw2",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "MIT",
"devDependencies": {
"browserify": "^10.1.3",
"gulp": "^3.8.11",
"gulp-react": "^3.0.1",
"vinyl-source-stream": "^1.1.0"
},
"dependencies": {
"react": "^0.13.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment