-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (37 loc) · 927 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
37
38
39
40
41
const gulp = require('gulp')
const { exec } = require('child_process')
let folders = ['articles/*.md', 'bug/*.md', 'flutter/*.md']
gulp.task('compile', function () {
'use strict'
var twig = require('gulp-twig')
return gulp
.src('./index.twig')
.pipe(
twig({
data: {
now: Date.now(),
// title: 'Gulp and Twig',
// benefits: [
// 'Fast',
// 'Flexible',
// 'Secure'
// ]
},
})
)
.pipe(gulp.dest('./'))
})
gulp.task('default', async function watchMd() {
// gulp.watch(['component.js', 'plugin.js', 'index.twig'], gulp.parallel(['compile']))
gulp.watch(folders, function (cb) {
exec('npm run toc:articles', (err, stdout, stderr) => {
if (err) {
console.error(err)
}
console.log(stdout)
console.error(stderr)
// body omitted
cb()
})
})
})