forked from kakaroto/Beyond20
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
51 lines (46 loc) · 1.16 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
const gulp = require('gulp');
const concat = require('gulp-concat');
const SRC_FILES = {
background: [
"src/constants.js",
"src/utils.js",
"src/settings.js",
"src/background.js"
],
options: [
"src/utils.js",
"src/settings.js",
"src/options.js"
],
default_popup: [
"src/utils.js",
"src/settings.js",
"src/default_popup.js"
],
popup: [
"src/constants.js",
"src/utils.js",
"src/settings.js",
"src/popup.js"
],
}
const targets = {};
for (const target in SRC_FILES) {
const task = {
[target]: () => {
return gulp.src(SRC_FILES[target])
.pipe(concat(`${target}.js`))
.pipe(gulp.dest("dist"))
}
};
targets[target] = task[target];
gulp.task(target, targets[target]);
}
watch = () => {
for (target in SRC_FILES)
gulp.watch(SRC_FILES[target], targets[target]);
}
build = gulp.series(...Object.values(targets));
gulp.task('watch', watch);
gulp.task('build', build);
gulp.task('default', gulp.series(build, watch));