-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (43 loc) · 1.27 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
var gulp = require('gulp')
var premailer = require('gulp-premailer')
var rev = require('gulp-rev')
var revCollector = require('gulp-rev-collector')
var htmlmin = require('gulp-htmlmin')
var del = require('del')
gulp.task('clean', function(cb) {
return del(['build'])
})
gulp.task('postclean', ['clean', 'html', 'assets', 'rev'], function(cb) {
return del(['build/assets/rev-manifest.json'])
})
gulp.task('assets', ['clean'], function() {
return gulp.src(['assets/**/*', '!assets/**/*.css'])
.pipe(rev())
.pipe(gulp.dest('build/assets'))
.pipe(rev.manifest())
.pipe(gulp.dest('build/assets'))
})
gulp.task('rev', ['clean', 'html', 'assets'], function() {
return gulp.src(['build/assets/*.json', 'build/*.html'])
.pipe(revCollector({
dirReplacements: {
assets: 'https://serve.gamekeller.net/email/'
}
}))
.pipe(gulp.dest('build'))
})
gulp.task('html', ['clean'], function() {
return gulp.src('*.html')
.pipe(premailer())
.pipe(htmlmin({
collapseWhitespace: true,
minifyCSS: true
}))
.pipe(gulp.dest('build'))
})
gulp.task('txt', ['clean'], function() {
return gulp.src('*.txt')
.pipe(gulp.dest('build'))
})
gulp.task('build', ['html', 'txt', 'assets', 'rev', 'postclean'])
gulp.task('default', ['build'])