forked from apigovau/national-api-design-standards
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (59 loc) · 1.55 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
64
65
66
var gulp = require('gulp'),
concat = require('gulp-concat'),
toc = require('gulp-markdown-toc'),
pdf = require('gulp-markdown-pdf'),
replace = require('gulp-replace'),
del = require('del');
/*
Build the templates into full HTML pages.
*/
gulp.task('combine', function() {
return gulp.src([
'sections/header.md',
'sections/toc.md',
'sections/getting-started.md',
'sections/definitions.md',
'sections/wog-api-requirements.md',
'sections/naming-conventions.md',
'sections/api-versioning.md',
'sections/api-request.md',
'sections/query-parameters.md',
'sections/api-response.md',
'sections/error-handling.md',
'sections/api-security.md',
'sections/hypermedia.md',
'sections/pagination.md',
'sections/networking.md',
'sections/webhooks.md',
'sections/testing.md',
'sections/footer.md',
],{allowEmpty: true})
.pipe(concat('combined.md'))
.pipe(toc())
.pipe(gulp.dest('target'));
});
gulp.task('pdf', function() {
var pdfOptions = {
remarkable: {
html:true
}
}
return gulp.src('target/combined.md')
.pipe(replace('<!-- toc -->', ''))
.pipe(replace('<!-- tocstop -->', ''))
.pipe(pdf(pdfOptions))
.pipe(gulp.dest('target'));
});
/*
Clean the build directories
*/
gulp.task('clean', function() {
return del([
'target/*'
])
});
gulp.task('default', gulp.series(
'clean',
'combine',
'pdf'
));