-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathgulpfile.js
63 lines (54 loc) · 1.42 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
57
58
59
60
61
62
63
const gulp = require('gulp')
const postcss = require('gulp-postcss')
const precss = require('precss')
const autoprefixer = require('autoprefixer')
const pug = require('gulp-pug')
const rev = require('gulp-rev')
const revReplace = require('gulp-rev-replace')
const rename = require('gulp-rename')
const sheets = ['git', 'linux']
gulp.task('view', ['style'], () => {
return sheets.map(sheet =>
gulp.src('src/view-template.pug')
.pipe(pug({
data: require(`./sheets/${sheet}.json`),
pretty: true
}))
.pipe(rename({
basename: sheet
}))
.pipe(revReplace({
manifest: gulp.src('./public/manifest.json')
}))
.pipe(gulp.dest('public'))
)
})
gulp.task('markdown', () => {
return sheets.map(sheet =>
gulp.src('src/markdown-template.pug')
.pipe(pug({
data: require(`./sheets/${sheet}.json`),
pretty: true
}))
.pipe(rename({
basename: sheet,
extname: '.md'
}))
.pipe(gulp.dest('docs'))
)
})
gulp.task('style', () => {
return gulp.src('src/style.css')
.pipe(postcss([precss, autoprefixer]))
.pipe(rev())
.pipe(gulp.dest('public'))
.pipe(rev.manifest({
path: 'manifest.json',
merge: true
}))
.pipe(gulp.dest('public'))
})
gulp.task('dev', ['view', 'markdown'], () => {
gulp.watch('src/*', ['view', 'markdown'])
})
gulp.task('default', ['view', 'markdown'])