-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (36 loc) · 833 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
36
37
38
39
40
41
42
43
44
var gulp = require('gulp');
var browserify = require('browserify');
var source = require("vinyl-source-stream");
var watchify = require('watchify');
var watch = false;
function browserifyShare() {
var b = browserify({
cache: {},
packageCache: {},
fullPaths: false,
standalone: 'glur'
});
if (watch) {
// if watch is enable, wrap this bundle inside watchify
b = watchify(b);
b.on('update', function () {
bundleShare(b);
});
}
b.add('./index.js');
bundleShare(b);
}
function bundleShare(b) {
b.bundle()
.pipe(source('glur.js'))
.pipe(gulp.dest('./example'));
}
gulp.task('browserify', function () {
watch = false;
browserifyShare();
});
gulp.task('browserify-watch', function () {
watch = true;
browserifyShare();
});
gulp.task('watch', ['browserify-watch']);