Created
July 25, 2014 02:08
-
-
Save heroicyang/ef3eec8b36e0070b85e1 to your computer and use it in GitHub Desktop.
Revisions
-
heroicyang created this gist
Jul 25, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ var gulp = require('gulp'); var source = require('vinyl-source-stream'); var browserify = require('browserify'); var watchify = require('watchify'); gulp.task('setWatch', function() { global.isWatching = true; }); gulp.task('browserify', function() { var bundleMethod = global.isWatching ? watchify : browserify; var bundler = bundleMethod({ entries: ['./src/js/app.coffee'], extensions: ['coffee'] }); var bundle = function() { return bundler .bundle({debug: true}) .pipe(source('app.js')) .pipe(gulp.dest('./build/')) }; if(global.isWatching) { bundle.on('update', bundle); } return bundle(); }); gulp.task('watch', ['setWatch', 'browserify'], function() { // ... }); gulp.task('default', ['watch']);