-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
92 lines (85 loc) · 2.53 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
const gulp = require('gulp');
const sass = require('gulp-sass');
const concat = require('gulp-concat');
const cleanCSS = require('gulp-clean-css');
const paths = {
scss: {
src_popup: [
"./assets/scss/popup.scss"
],
src_options: [
"./assets/scss/options.scss"
],
watch: "./assets/scss/**/*.scss",
dest: "./app/"
},
js: {
src_popup: [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/qrcode-generator/qrcode.js",
"./node_modules/@otplib/preset-browser/buffer.js",
"./node_modules/@otplib/preset-browser/index.js",
"./node_modules/jquery-circle-progress/dist/circle-progress.min.js",
"./node_modules/popper.js/dist/umd/popper.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js",
"./assets/js/popup.js"
],
src_options: [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/popper.js/dist/umd/popper.min.js",
"./node_modules/bootstrap/dist/js/bootstrap.min.js",
"./node_modules/bootbox/dist/bootbox.min.js",
"./node_modules/bootbox/dist/bootbox.locales.min.js",
"./assets/js/options.js"
],
watch: "./assets/js/**/*.js",
dest: "./app/"
}
};
function style_popup() {
return (
gulp
.src(paths.scss.src_popup)
.pipe(sass())
.on("error", sass.logError)
.pipe(concat('popup-min.css'))
.pipe(cleanCSS())
.pipe(gulp.dest(paths.scss.dest))
);
}
function style_options() {
return (
gulp
.src(paths.scss.src_options)
.pipe(sass())
.on("error", sass.logError)
.pipe(concat('options-min.css'))
.pipe(cleanCSS())
.pipe(gulp.dest(paths.scss.dest))
);
}
function bundle_popup() {
return (
gulp
.src(paths.js.src_popup)
.pipe(concat('popup.js'))
.pipe(gulp.dest(paths.js.dest))
)
}
function bundle_options() {
return (
gulp
.src(paths.js.src_options)
.pipe(concat('options.js'))
.pipe(gulp.dest(paths.js.dest))
)
}
function watch() {
style_popup();
style_options();
bundle_popup();
bundle_options();
gulp.watch(paths.scss.watch, gulp.parallel(style_popup, style_options));
gulp.watch(paths.js.watch, gulp.parallel(bundle_popup, bundle_options));
}
exports.watch = watch;