-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathgulpfile.js
45 lines (38 loc) · 994 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
37
38
39
40
41
42
43
44
45
const gulp = require("gulp");
const htmlmin = require("gulp-html-minifier-terser");
const csso = require("gulp-csso");
const terser = require("gulp-terser");
const paths = {
input: {
assets: "src/public/**/*",
html: "src/public/**/*.html",
css: "src/public/**/*.css",
js: "src/public/**/*.js",
},
output: "dist/public",
};
const { input, output } = paths;
const { series, parallel } = gulp;
function copyAssets() {
return gulp.src(input.assets).pipe(gulp.dest(output));
}
function minHtml() {
return gulp
.src(input.html)
.pipe(
htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true,
})
)
.pipe(gulp.dest(output));
}
function minCss() {
return gulp.src(input.css).pipe(csso()).pipe(gulp.dest(output));
}
function minJs() {
return gulp.src(input.js).pipe(terser()).pipe(gulp.dest(output));
}
exports.build = series(copyAssets, parallel(minHtml, minCss, minJs));