-
-
Save kyleva/05e1d4a2fb3ed0a1ef35 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 browserify = require('browserify'); | |
| var watchify = require('watchify'); | |
| var reactify = require('reactify'); | |
| var gulp = require('gulp'); | |
| var handleErrors = require('../util/handleErrors'); | |
| var source = require('vinyl-source-stream'); | |
| function scripts(watch) { | |
| var bundler, rebundle; | |
| if(watch) { | |
| bundler = watchify('./app/scripts/app.js'); | |
| } else { | |
| bundler = browserify('./app/scripts/app.js'); | |
| } | |
| bundler.transform(reactify); | |
| rebundle = function() { | |
| var stream = bundler.bundle({debug: true}); | |
| stream.on('error', handleErrors); | |
| stream = stream.pipe(source('app.js')); | |
| return stream.pipe(gulp.dest('./build/')); | |
| }; | |
| bundler.on('update', rebundle); | |
| return rebundle(); | |
| } | |
| gulp.task('browserify-build', function() { | |
| return scripts(false); | |
| }); | |
| gulp.task('browserify-watch', function() { | |
| return scripts(true); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment