-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathgulpfile.js
47 lines (43 loc) · 1.16 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
let gulp = require('gulp');
let cleancss = require('gulp-clean-css');
let uglify = require('gulp-uglify');
let pipeline = require('readable-stream').pipeline;
let htmlMin = require('gulp-htmlmin');
let prettyHtml = require('gulp-pretty-html');
gulp.task('minify-css', () => {
return gulp.src('docs/**/*.css')
.pipe(cleancss({
level: 1
}))
.pipe(gulp.dest('docs/'))
});
gulp.task('minify-js', function () {
return pipeline(
gulp.src([
'docs/**/*.js'
]),
uglify({
mangle: {
reserved: ['user']
}
}),
gulp.dest('docs/')
)
});
gulp.task('minify-html', () => {
return gulp.src('docs/**/*.html')
.pipe(htmlMin({
collapseWhitespace: true,
removeComments: true
}))
.pipe(gulp.dest('docs/'));
});
gulp.task('pretty-html', function () {
return gulp.src('docs/**/*.html')
.pipe(prettyHtml({
indent_size: 2,
indent_char: ' ',
unformatted: ['code', 'pre', 'em', 'strong', 'span', 'i', 'b', 'br', 'figure']
}))
.pipe(gulp.dest('docs/'));
});