-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
35 lines (29 loc) · 926 Bytes
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var browserify = require('browserify');
var watchify = require('watchify');
var glob = require('glob');
var path = require('path');
var gutil = require('gulp-util');
gulp.task('default', function() {
var bundler = browserify({
cache: {},
packageCache: {},
fullPaths: true,
entries: ['./js/index.js'],
debug: true
});
var bundler = watchify(bundler);
// To support React Dev Tools, we need React to be requireable
// bundler.require('react');
bundler.on('update', rebundle);
bundler.on('log', gutil.log);
var outFile = './examples/todomvc/js/app.js';
function rebundle () {
return bundler.bundle()
.on('error', function(err) { gutil.log('ERROR: ' + err.message); gutil.beep(); })
.pipe(source(path.basename(outFile)))
.pipe(gulp.dest(path.dirname(outFile)));
}
return rebundle();
});