This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 528
/
gulpfile.babel.js
113 lines (103 loc) · 2.35 KB
/
gulpfile.babel.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const gulp = require('gulp');
const watch = require('gulp-watch');
const ghpages = require('gh-pages');
const connect = require('gulp-connect');
const open = require('gulp-open');
require('./gulp/i18n');
require('./gulp/build');
require('./gulp/plato');
gulp.task(
'connect',
gulp.series(done => {
connect.server({
root : 'www',
port : 80,
livereload: true,
});
done();
})
);
gulp.task(
'open',
gulp.series(done => {
gulp.src('www/index.html').pipe(
open({
uri: 'http://localhost:80/',
})
);
done();
})
);
gulp.task(
'serve',
gulp.series('open', 'connect', done => {
watch(['www/*.html']).pipe(connect.reload());
done();
})
);
gulp.task(
'release-branch',
gulp.series(done => {
const index = process.argv.indexOf('--branch');
let option = '';
if (index <= -1) {
throw Error('Please specify branch');
} else {
option = process.argv[index + 1];
}
ghpages
.publish('www', {
dest: option,
add : true,
})
.then(done);
})
);
gulp.task(
'release-master',
gulp.series(done => {
ghpages
.publish('./', {
src: ['404.md', 'LICENSE', 'README.md', 'CNAME'],
add: true,
})
.then(() => {
ghpages.publish('www', {
add: true,
});
})
.then(done);
})
);
gulp.task(
'test-deploy',
gulp.series('build-min', 'serve', () => {})
);
gulp.task(
'watch-static',
gulp.parallel(done => {
gulp.watch(
['static/xml/**/*', 'static/*.html', 'static/css/*.scss'],
{
debounceTimeout: 1000,
},
gulp.series('build-dev-static')
);
done();
})
);
gulp.task(
'watch-html',
gulp.series(done => {
gulp.watch(
['templates/**/*'],
{
debounceTimeout: 1000,
},
gulp.series('build-dev-html')
);
done();
})
);
gulp.task('watch', gulp.series('build', 'serve', 'watch-static', 'watch-html'));
gulp.task('default', gulp.series('watch'));