This repository has been archived by the owner on Oct 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
77 lines (68 loc) · 1.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
import gulp from "gulp";
import imagemin from "gulp-imagemin";
import GulpCleanCss from "gulp-clean-css";
import minify from "gulp-minify";
import htmlmin from "gulp-htmlmin";
import removeHTMLComments from "gulp-remove-html-comments";
function minifyImages() {
return gulp
.src("assets/images/**/*")
.pipe(imagemin())
.pipe(gulp.dest("build/assets/images"));
}
function minifyIcons() {
return gulp
.src("assets/icons/**/*")
.pipe(imagemin())
.pipe(gulp.dest("build/assets/icons"));
}
function minifyCSS() {
return gulp
.src("assets/css/**/*")
.pipe(GulpCleanCss())
.pipe(gulp.dest("build/assets/css"));
}
function minifyJS() {
return gulp
.src("assets/js/**/*")
.pipe(
minify({
noSource: true,
ext: {
min: ".js",
},
})
)
.pipe(gulp.dest("build/assets/js"));
}
function minifyHTML() {
return gulp
.src("index.html")
.pipe(removeHTMLComments())
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest("build"));
}
function minifyFontsCSS() {
return gulp
.src("assets/css/*.css")
.pipe(GulpCleanCss())
.pipe(gulp.dest("build/assets/css"));
}
function copyFonts() {
return gulp
.src("assets/fonts/*.{otf,ttf,woff}")
.pipe(gulp.dest("build/assets/fonts"));
}
function copyFavicon() {
return gulp.src("assets/favicon.ico").pipe(gulp.dest("build/assets/"));
}
export default gulp.parallel(
minifyImages,
minifyIcons,
minifyCSS,
minifyJS,
minifyHTML,
minifyFontsCSS,
copyFonts,
copyFavicon
);