Created
April 10, 2015 11:02
-
-
Save hequ/79fb775412ea4d044fdd to your computer and use it in GitHub Desktop.
Gulpfile with watch for React and Browserify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this gist!