-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
44 lines (40 loc) · 1.09 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
let gulp = require('gulp');
let minifyCSS = require("gulp-minify-css");
let minifyHTML = require('gulp-htmlmin');
let babel = require('gulp-babel');
let uglify = require('gulp-uglify');
let stripDebug = require('gulp-strip-debug');
gulp.task('minifycss', done => {
gulp.src('./assets/css/**/*.css')
.pipe(minifyCSS())
.pipe(gulp.dest('./assets/css/'));
done();
});
gulp.task('minifyhtml', function () {
return gulp.src('./assets/**/*.html')
.pipe(minifyHTML({
collapseWhitespace: true,
removeComments: true,
minifyCSS: false,
minifyJS: true
}))
.pipe(gulp.dest('./assets/'));
});
gulp.task('minifyjs', function () {
return gulp.src('./assets/scripts/**/*.js')
.pipe(babel({
presets: [
['@babel/env', {
modules: false
}]
]
}))
.pipe(uglify())
.pipe(stripDebug())
.pipe(gulp.dest('./assets/scripts/'));
});
gulp.task('minify', gulp.parallel(
'minifycss',
'minifyhtml',
'minifyjs'
));