forked from OI-wiki/OI-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
36 lines (33 loc) · 924 Bytes
/
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
const gulp = require('gulp')
const htmlmin = require('gulp-htmlmin')
const purifycss = require('gulp-purifycss')
const postcss = require('gulp-postcss')
gulp.task('minify:html', () => {
return gulp.src('site/**/*.html')
.pipe(htmlmin({
collapseWhitespace: true,
conservativeCollapse: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true,
removeComments: true,
removeOptionalTags: true,
removeRedundantAttributes: true,
removeStyleLinkTypeAttributes: true,
removeScriptTypeAttributes: true,
useShortDoctype: true
}))
.pipe(gulp.dest('site'))
})
gulp.task('minify:css', () => {
return gulp
.src(`site/**/*.css`)
.pipe(purifycss([`site/**/*.html`, `site/**/*.js`]))
.pipe(
postcss([
require('cssnano')()
])
)
.pipe(gulp.dest('site'))
})
gulp.task('minify', gulp.series('minify:html', 'minify:css'))