-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
62 lines (56 loc) · 1.52 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
const { dest, series, parallel, src, watch } = require('gulp');
const gulpClean = require('gulp-clean');
const gulpHtmlPdf = require('gulp-html2pdf');
const gulpMustache = require('gulp-mustache');
const gulpRename = require('gulp-rename');
/**
* Clean distribution folder.
* @param {function} cb Callback function.
*/
function clean(cb) {
src('dist/*', { read: false }).pipe(gulpClean());
cb();
}
/**
* Generate PDF version of resume.
* @param {function} cb Callback function.
*/
function pdf(cb) {
src('dist/scott-weaver_resume.html').pipe(gulpHtmlPdf()).pipe(dest('dist'));
cb();
}
/**
* Generate HTML version of resume.
* @param {function} cb Callback function.
*/
function html(cb) {
src('src/templates/scott-weaver_resume.html.mustache')
.pipe(gulpMustache('src/data/resume.json'))
.pipe(gulpRename({ extname: '' }))
.pipe(dest('dist'));
cb();
}
/**
* Generate Markdown version of resume.
* @param {function} cb Callback function.
*/
function markdown(cb) {
src('src/templates/scott-weaver_resume.md.mustache')
.pipe(gulpMustache('src/data/resume.json'))
.pipe(gulpRename({ extname: '' }))
.pipe(dest('dist'));
cb();
}
/**
* Watch src directory for markdown files.
* @param {function} cb Callback function.
*/
function watcher(cb) {
series(clean, html, pdf, markdown);
watch('src/**/*.*', series(clean, html, parallel(markdown, pdf)));
cb();
}
exports.build = series(clean, html, parallel(markdown, pdf));
exports.clean = clean;
exports.watcher = watcher;
exports.default = watcher;