-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
53 lines (45 loc) · 1.22 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
var gulp = require('gulp');
var exec = require("child_process").exec;
var runSequence = require('run-sequence');
var del = require('del');
var gulpGitbook = require('gulp-gitbook');
var exec = require('child_process').exec;
gulp.task('default', function() {
// place code for your default task here
});
gulp.task('build', function(cb) {
runSequence(
'refresh-summary',
'generate-book',
function() {
gulpGitbook(".", cb);
});
});
gulp.task('build-light', function(cb) {
runSequence(
'refresh-summary',
function() {
gulpGitbook.website(".", cb);
});
});
gulp.task('serve', function(cb) {
runSequence(
'refresh-summary',
function() {
gulpGitbook.serve(".", cb);
});
});
gulp.task('refresh-summary', function(cb) {
exec('node ./node_modules/gitbook-summary/bin/summary.js sm', function(error, stdout, stderr) {
cb(error);
});
});
gulp.task('generate-book', function(cb) {
gulpGitbook.pdf(".", {outputDir: "./downloads/book.pdf"}, function(err) {
if(err) { cb(err); return; }
gulpGitbook.epub(".", {outputDir: "./downloads/book.epub"}, function(err) {
if(err) { cb(err); return; }
gulpGitbook.mobi(".", {outputDir: "./downloads/book.mobi"}, cb);
});
});
});