-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (49 loc) · 1.34 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
/* Requires */
var gulp = require('gulp');
var plumber = require('gulp-plumber');
var htmlmin = require('gulp-htmlmin');
var cleancss = require('gulp-clean-css');
var uglifyjs = require('gulp-uglify');
var gzip = require('gulp-gzip');
var del = require('del');
/* HTML Task */
gulp.task('html', function() {
return gulp.src(['html/*.html', 'html/*.htm'])
.pipe(plumber())
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true}))
.pipe(gzip())
.pipe(gulp.dest('data/www'));
});
/* CSS Task */
gulp.task('css', function() {
return gulp.src(['html/*.css'])
.pipe(plumber())
.pipe(cleancss())
.pipe(gzip())
.pipe(gulp.dest('data/www'));
});
/* JavaScript Task */
gulp.task('js', function() {
return gulp.src(['html/*.js'])
.pipe(plumber())
.pipe(uglifyjs())
.pipe(gzip())
.pipe(gulp.dest('data/www'));
});
/* Clean Task */
gulp.task('clean', function() {
return del(['data/www/*']);
});
/* Watch Task */
gulp.task('watch', function() {
gulp.watch('html/*.html', ['html']);
gulp.watch('html/*.htm', ['html']);
gulp.watch('html/*.css', ['css']);
gulp.watch('html/*.js', ['js']);
});
/* Default Task */
gulp.task('default', ['clean', 'html', 'css', 'js']);