-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
40 lines (34 loc) · 1.08 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
const gulp = require('gulp');
const del = require('del');
const gulpGitbook = require('gulp-gitbook');
const shell = require('gulp-shell');
const gulpLoadPlugins = require('gulp-load-plugins');
const $ = gulpLoadPlugins();
// Publishes the site to GitHub Pages
gulp.task('publish', () => {
console.log('Publishing to GH Pages');
return gulp.src('./_book/**/*')
.pipe($.ghPages({
origin: 'origin',
branch: 'gh-pages'
}));
});
gulp.task('clean', () => {
console.log('Clean build directory');
return del(['./_book/**/*', '!./_book/.keep']);
});
gulp.task('build', function (cb) {
console.log('Building HTML version')
gulpGitbook('.', cb);
});
// FIXME: smh, you should actually learn how to use gulp
gulp.task('build-ebooks', () => {
console.log('Building PDF, ePUB, and MOBI versions')
shell.task([
'gitbook pdf docs _book/hybox-models.pdf',
'gitbook epub docs _book/hybox-models.epub',
'gitbook mobi docs _book/hybox-models.mobi',
]);
});
gulp.task('default', ['clean', 'build', 'publish']);
gulp.task('travis', ['clean', 'build', 'build-ebooks']);