-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
36 lines (31 loc) · 940 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
const { src, dest, watch, series, parallel } = require("gulp");
const concat = require("gulp-concat");
const uglify = require("gulp-uglify");
const rename = require("gulp-rename");
const files = {
scssPath: "src/sass/**/*.scss",
jsPath: "src/**/*.js",
demoJS: "demo/js",
dist: "dist",
};
function uglifyTask() {
return src(files.jsPath)
.pipe(uglify())
.pipe(rename({ extname: ".min.js" }))
.pipe(dest(files.dist))
.pipe(dest(files.demoJS));
}
function copyJS() {
return src(files.jsPath).pipe(dest(files.dist)).pipe(dest(files.demoJS));
}
// Watch task: watch SCSS and JS files for changes
// If any change, run scss and js tasks simultaneously
function watchTask() {
watch(
[files.scssPath, files.jsPath],
{ interval: 1000, usePolling: true }, //Makes docker work
series(parallel(uglifyTask, copyJS))
);
}
exports.default = parallel(uglifyTask, copyJS, watchTask);
exports.build = parallel(uglifyTask, copyJS);