-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
49 lines (44 loc) · 1.22 KB
/
Gulpfile.js
File metadata and controls
49 lines (44 loc) · 1.22 KB
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
const gulp = require('gulp')
const sass = require('gulp-sass')
const htmlmin = require('gulp-htmlmin')
const minifyInline = require('gulp-minify-inline')
const purgecss = require('gulp-purgecss')
const rev = require('gulp-rev')
const collect = require('gulp-rev-collector')
const sassOption = {
outputStyle: 'compressed',
includePaths: 'node_modules'
}
gulp.task('build-dev', () => gulp
.src(['./styles/main.scss'])
.pipe(sass(sassOption).on('error', sass.logError))
.pipe(gulp.dest('./static/css'))
)
gulp.task('build-prod', () => gulp
.src(['./styles/main.scss'])
.pipe(sass(sassOption).on('error', sass.logError))
.pipe(purgecss({ content: ['layouts/**/*.html', 'content/**/*.md'] }))
.pipe(gulp.dest('./static/css'))
.pipe(rev())
.pipe(gulp.dest('./static/css'))
.pipe(rev.manifest())
.pipe(gulp.dest('rev'))
)
gulp.task('minify', function () {
gulp.src(['./public/**/*.html'])
.pipe(htmlmin({
collapseWhitespace: true,
removeComments: true,
minifyCSS: true,
minifyJS: true
}))
.pipe(minifyInline())
.pipe(gulp.dest('./public'))
});
gulp.task('collect', function () {
return gulp.src(['rev/**/*.json', './public/**/*.html'])
.pipe(collect({
replaceReved: true,
}))
.pipe(gulp.dest('./public'))
});