-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
56 lines (53 loc) · 1.88 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
56
const gulp = require('gulp');
const plumber = require('gulp-plumber');
const htmlmin = require('gulp-htmlmin');
const cleancss = require('gulp-clean-css');
const gzip = require('gulp-gzip');
const del = require('del');
const useref = require('gulp-useref');
const gulpif = require('gulp-if');
gulp.task('clean', function () {
return del(['data/*']);
});
gulp.task('www', function () {
return gulp.src('www/**')
.pipe(plumber())
.pipe(gulpif('*.html', htmlmin({
"caseSensitive": false,
"collapseBooleanAttributes": true,
"collapseInlineTagWhitespace": false,
"collapseWhitespace": true,
"conservativeCollapse": false,
"decodeEntities": true,
"html5": true,
"includeAutoGeneratedTags": false,
"keepClosingSlash": false,
"maxLineLength": 0,
"minifyCSS": true,
"minifyJS": true,
"preserveLineBreaks": false,
"preventAttributesEscaping": false,
"processConditionalComments": true,
"processScripts": [
"text/html"
],
"removeAttributeQuotes": true,
"removeComments": true,
"removeEmptyAttributes": true,
"removeEmptyElements": false,
"removeOptionalTags": true,
"removeRedundantAttributes": true,
"removeScriptTypeAttributes": true,
"removeStyleLinkTypeAttributes": true,
"removeTagWhitespace": true,
"sortAttributes": true,
"sortClassName": true,
"trimCustomFragments": true,
"useShortDoctype": true
})))
.pipe(gulpif('*.css', cleancss()))
.pipe(gulpif("!*.json", gzip()))
.pipe(gulp.dest('data'));
});
gulp.task('buildfs', gulp.series('clean', 'www'));
gulp.task('default', gulp.series('buildfs'));