Skip to content

Instantly share code, notes, and snippets.

@hequ
Created April 10, 2015 11:02
Show Gist options
  • Save hequ/79fb775412ea4d044fdd to your computer and use it in GitHub Desktop.
Save hequ/79fb775412ea4d044fdd to your computer and use it in GitHub Desktop.
Gulpfile with watch for React and Browserify
var source = require('vinyl-source-stream'),
gulp = require('gulp'),
browserify = require('browserify'),
reactify = require('reactify'),
notify = require('gulp-notify');
var sourcesDir = './ui/jsx',
appEntryPoint = "app.js",
targetDir = './src/main/webapp';
gulp.task('default', function() {
return browserify({entries: [sourcesDir + '/' + appEntryPoint], debug: true})
.transform(reactify)
.bundle()
.pipe(source(appEntryPoint))
.pipe(gulp.dest(targetDir))
.pipe(notify("Bundling done."));
});
gulp.task('watch', function() {
gulp.watch(sourcesDir + '/' + "*.js", ['default']);
});
@asuraphel
Copy link

Thanks for this gist!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment