-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.cjs
56 lines (48 loc) · 1.39 KB
/
gulpfile.cjs
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
const { src, dest, watch, series, parallel } = require("gulp");
const sass = require("gulp-sass")(require("sass"));
const terser = require("gulp-terser");
const postcss = require("gulp-postcss");
const autoprefixer = require("autoprefixer");
const cssnano = require("cssnano");
const files = {
bootstrapPath: "src/bootstrap/5.3.0/**/*.scss",
scssPath: "src/styles/*.scss",
jsPath: "src/scripts/**/*.js",
};
function scssTask() {
return src(files.scssPath, { sourcemaps: true })
.pipe(sass())
.pipe(postcss([autoprefixer(), cssnano()]))
.pipe(dest("public/css", { sourcemaps: "." }));
}
function bootstrapTask() {
return src(files.bootstrapPath, { sourcemaps: true })
.pipe(sass())
.pipe(postcss([autoprefixer(), cssnano()]))
.pipe(dest("public/bootstrap", { sourcemaps: "." }));
}
function jsTask() {
return src(
[
files.jsPath,
//,'!' + 'includes/js/jquery.min.js',
],
{ sourcemaps: true }
)
.pipe(terser())
.pipe(dest("public/js", { sourcemaps: "." }));
}
function watchJS() {
watch([files.jsPath], { interval: 1000, usePolling: true }, series(jsTask));
}
function watchCSS() {
watch(
[files.scssPath],
{ interval: 1000, usePolling: true },
series(scssTask)
);
}
exports.default = series(
parallel(bootstrapTask, scssTask, jsTask),
parallel(watchJS, watchCSS)
);