-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
64 lines (47 loc) · 1.39 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
const gulp = require('gulp');
const watch = require('gulp-watch');
const zip = require('gulp-zip');
function build(cb) {
console.log('> Construction of browsers extensions');
//Common files
gulp.src(['src/common/**/*'])
.pipe(gulp.dest('build/chrome/'))
.pipe(gulp.dest('build/firefox/'))
//Chrome specifics files
gulp.src(['src/chrome/**/*'])
.pipe(gulp.dest('build/chrome/'))
//Firefox specifics files
gulp.src(['src/firefox/**/*'])
.pipe(gulp.dest('build/firefox/'))
console.log('> Construction done ! Look at build folder');
cb();
}
function livewatch(cb) {
console.log('> Livewatch autoreload on !')
//Watch on common files
watch(['src/common/**/*'], {verbose: true})
.pipe(gulp.dest('build/chrome/'))
.pipe(gulp.dest('build/firefox/'))
//Watch on chrome files
watch(['src/chrome/**/*'], {verbose: true})
.pipe(gulp.dest('build/chrome/'))
//Watch on firefox files
watch(['src/firefox/**/*'], {verbose: true})
.pipe(gulp.dest('build/firefox/'))
cb();
}
function pack(cb) {
console.log('> Building zip packages');
gulp.src('build/firefox/**/*')
.pipe(zip('firefox.zip'))
.pipe(gulp.dest('build'))
gulp.src('build/chrome/**/*')
.pipe(zip('chrome.zip'))
.pipe(gulp.dest('build'))
console.log('> Packages builded ! Look at build folder');
cb();
}
exports.default = gulp.parallel(build, livewatch)
exports.watch = livewatch;
exports.build = build;
exports.pack = pack;