Last active
August 29, 2015 14:15
-
-
Save gaving/c1dce867b8e4fa86e5c9 to your computer and use it in GitHub Desktop.
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
mbp:~/Sandbox/test% npm version | |
{ npm: '2.6.0', | |
http_parser: '2.3', | |
modules: '14', | |
node: '0.12.0', | |
openssl: '1.0.1l', | |
uv: '1.0.2', | |
v8: '3.28.73', | |
zlib: '1.2.8' } | |
mbp:~/Sandbox/test% gulp watchify | |
[14:15:07] Using gulpfile ~/Sandbox/test/gulpfile.js | |
[14:15:07] Starting 'watchify'... | |
^C | |
gulp watchify 38.60s user 5.12s system 103% cpu 42.088 total |
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
'use strict'; | |
var gulp = require('gulp'); | |
var browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var source = require('vinyl-source-stream'); | |
var babelify = require('babelify'); | |
module.exports = gulp.task('watchify', function () { | |
var bundler = browserify({ | |
cache: {}, | |
packageCache: {}, | |
fullPaths: true, | |
entries: [config.paths.src.js], | |
debug: true, | |
extensions: ['.js'] | |
}); | |
bundler = watchify(bundler); | |
bundler.transform(babelify); | |
function rebundle() { | |
return bundler.bundle() | |
.pipe(source(config.filenames.build.scripts)) | |
.pipe(gulp.dest(config.paths.dest.build.scripts)); | |
} | |
bundler.on('update', rebundle); | |
return rebundle(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment