-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
62 lines (58 loc) · 1.48 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
import gulp from "gulp";
import concat from "gulp-concat";
import minify from "gulp-minify";
import cleanCss from "gulp-clean-css";
import rev from "gulp-rev";
import { deleteSync } from "del";
gulp.task(
"pack-js",
gulp.series(function () {
deleteSync(["asset/public/*.js"]);
return gulp
.src(["asset/js/autocomplete.js", "asset/js/search.js"])
.pipe(concat({ path: "bundle.js", cwd: "" }))
.pipe(
minify({
ext: {
min: ".js",
},
noSource: true,
})
)
.pipe(rev())
.pipe(gulp.dest("asset/public"))
.pipe(
rev.manifest({
base: "asset/public",
merge: true, // Merge with the existing manifest if one exists
})
)
.pipe(gulp.dest("asset/public"));
})
);
gulp.task(
"pack-css",
gulp.series(function () {
deleteSync(["asset/public/*.css"]);
return gulp
.src(["asset/css/search.css"])
.pipe(concat({ path: "stylesheet.css", cwd: "" }))
.pipe(cleanCss())
.pipe(rev())
.pipe(gulp.dest("asset/public"))
.pipe(
rev.manifest({
base: "asset/public",
merge: true, // Merge with the existing manifest if one exists
})
)
.pipe(gulp.dest("asset/public"));
})
);
gulp.task("watch", function () {
gulp.watch(
["asset/js/*.js", "asset/css/*.css"],
gulp.series("pack-js", "pack-css")
);
});
gulp.task("default", gulp.series("pack-js", "pack-css", "watch"));