forked from konvajs/site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
73 lines (63 loc) · 2.06 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
67
68
69
70
71
72
73
var gulp = require('gulp'),
clean = require('gulp-clean'),
shell = require('gulp-shell'),
jsdoc = require("gulp-jsdoc"),
webserver = require('gulp-webserver');
// steps
// 1. clean /public folder
// 2. generate new /public with hexo
// 3. replace /public/downloads with /source/downloads
// 4. generate api docs to /public
// 1
gulp.task('clean-public', function(){
return gulp.src('public', {read: false})
.pipe(clean());
});
// 2
gulp.task('generate-hexo', ['clean-public'], shell.task(['node ./node_modules/hexo/bin/hexo generate'], {cwd: './'}));
// 3
gulp.task('clean-public-downloads', ['generate-hexo'], function(){
return gulp.src('public/downloads', {read: false})
.pipe(clean());
});
gulp.task('copy-source-download', ['clean-public-downloads'] ,function() {
return gulp.src('source/downloads/**')
.pipe(gulp.dest('public/downloads'));
});
// 4
gulp.task('docs', ['generate-hexo'], function() {
return gulp.src("konva.js")
.pipe(jsdoc('./public/api', {
"path": "ink-docstrap",
"cleverLinks" : false,
"monospaceLinks" : false,
"dateFormat" : "ddd MMM Do YYYY",
"outputSourceFiles" : true,
"outputSourcePath" : true,
"systemName" : "Konva",
"footer" : "",
"copyright" : "Konva Copyright © 2015 The contributors to the Konva project.",
"navType" : "vertical",
"theme" : "cosmo",
"linenums" : true,
"collapseSymbols" : false,
"inverseNav" : true,
"highlightTutorialCode" : true,
"analytics" : {
"ua" : "UA-54202824-2",
"domain" : "http://konvajs.github.io"
}
}))
});
gulp.task('server', function() {
gulp.src('public')
.pipe(webserver({}));
});
gulp.task('generate', [
'clean-public',
'generate-hexo',
'clean-public-downloads',
'copy-source-download',
'docs'
]);
gulp.task('default', ['generate', 'server']);