-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
38 lines (32 loc) · 959 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
var gulp = require('gulp'),
concat = require('gulp-concat'),
io = require('socket.io')(35729),
browserify = require('browserify'),
source = require('vinyl-source-stream'),
gcb = require('gulp-callback');
gulp.task('dev', function() {
var reload = function() {
io.emit('fileChange', {
reload: true
});
}
var copyBackgroundScript = function() {
return browserify(['src/background-dev.js', 'src/background.js']).bundle()
.pipe(source('background.js'))
.pipe(gulp.dest('./'))
.pipe(gcb(reload));
}
var copyContentScript = function() {
return browserify(['src/content.js']).bundle()
.pipe(source('content.js'))
.pipe(gulp.dest('./'))
.pipe(gcb(reload));
}
var copyScripts = function() {
copyBackgroundScript();
copyContentScript();
}
gulp.watch(['src/*.js'], copyScripts);
copyScripts();
});
gulp.task('default', ['dev']);