-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
38 lines (34 loc) · 872 Bytes
/
gulpfile.babel.js
File metadata and controls
38 lines (34 loc) · 872 Bytes
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
import gulp from 'gulp'
import babel from 'gulp-babel'
import cleancss from 'gulp-clean-css'
import htmlmin from 'gulp-htmlmin'
import uglify from 'gulp-uglify'
gulp.task('minify-html', () => {
return gulp.src('public/**/*.html')
.pipe(htmlmin({
collapseWhitespace: true,
minifyCSS: true,
minifyJS: true,
removeComments: true,
useShortDoctype: true,
}))
.pipe(gulp.dest('./public'));
});
gulp.task('minify-js', () => {
return gulp.src('public/**/*.js', {base: './'})
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(uglify())
.pipe(gulp.dest('./'));
});
gulp.task('minify-css', () => {
return gulp.src('public/**/*.css', {base: './'})
.pipe(cleancss({level: 2, debug: true}))
.pipe(gulp.dest('./'));
});
gulp.task('minify', gulp.parallel(
'minify-html',
'minify-js',
'minify-css',
));