forked from Fechin/reference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
37 lines (33 loc) · 970 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
const gulp = require('gulp');
const htmlmin = require('gulp-htmlmin');
const htmlclean = require('gulp-htmlclean');
const version = require('gulp-version-number');
const terser = require('gulp-terser');
// Compress js files
gulp.task('js', function () {
return gulp.src(['./public/js/main.js'])
.pipe(terser({
compress: true
}))
.pipe(gulp.dest('./public/js'));
});
// Build html files
gulp.task('html', function () {
return gulp.src('./public/**/*.html')
.pipe(htmlclean())
.pipe(htmlmin({
removeComments: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
}))
.pipe(version({
'append': {
'key': '_v',
'cover': 1,
'to': ['css', 'js', 'png', 'jpg', 'woff2']
}
}))
.pipe(gulp.dest('./public'));
});
gulp.task('default', gulp.parallel('js', 'html'));