-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
47 lines (39 loc) · 1.11 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
const gulp = require('gulp');
const cleanCSS = require('gulp-clean-css');
const htmlmin = require('gulp-htmlmin');
const minifyJs = require('gulp-minify');
const imagemin = require('gulp-imagemin');
gulp.task('minify-css', () => {
return gulp.src('./*.css')
.pipe(cleanCSS())
.pipe(gulp.dest('public'));
});
gulp.task('minify-html', () => {
return gulp.src('./*.html')
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(gulp.dest('public'));
});
gulp.task('minify-js', function() {
return gulp.src('./app.js')
.pipe(minifyJs())
.pipe(gulp.dest('public'))
});
gulp.task('minify-images', function() {
return gulp.src('assets/img/*')
.pipe(imagemin())
.pipe(gulp.dest('public/assets/img'))
});
gulp.task('default', function() {
gulp.watch('./*.css', function(e) {
gulp.task('minify-css');
});
gulp.watch('./*.html', function(e) {
gulp.task('minify-html');
});
gulp.watch('./*.js', function(e) {
gulp.task('minify-js');
});
gulp.watch('assets/img/*', function(e) {
gulp.task('minify-images');
});
});