-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
64 lines (55 loc) · 1.33 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
const { series, parallel, src, dest } = require('gulp');
const del = require('del');
const uglify = require('gulp-uglify');
const htmlmin = require('gulp-htmlmin');
const cssmin = require('gulp-clean-css');
const zip = require('gulp-zip');
const paths = {
root: '.',
src: {
base: 'dist',
html: `dist/*.html`,
css: `dist/*.css`,
js: `dist/*.js`,
img: `dist/*.png`
},
dist: {
base: 'public',
dir: `public`,
all: `public/**/*`
},
zip: `public.zip`
};
const htmlOptions = { collapseWhitespace: true }
function cleanTask() {
return del([paths.dist.dir, paths.zip]);
}
function buildJsTask() {
return src(paths.src.js)
// .pipe(uglify())
.pipe(dest(paths.dist.dir));
}
function buildHtmlTask() {
return src(paths.src.html)
.pipe(htmlmin(htmlOptions))
.pipe(dest(paths.dist.dir));
}
function buildCssTask() {
return src(paths.src.css)
.pipe(cssmin())
.pipe(dest(paths.dist.dir));
}
function copyImages() {
return src(paths.src.img)
.pipe(dest(paths.dist.dir));
}
function zipTask() {
return src(paths.dist.all)
.pipe(zip(paths.zip))
.pipe(dest(paths.root))
}
exports.build = series(
cleanTask,
parallel(buildJsTask, buildHtmlTask, buildCssTask, copyImages),
zipTask
);