-
Notifications
You must be signed in to change notification settings - Fork 30
/
gulpfile.js
71 lines (63 loc) · 2.09 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
var gulp = require('gulp');
var webserver = require('gulp-webserver');
var del = require('del');
var requireDir = require('require-dir');
var tasks = requireDir('./tasks');
// Clean dist directory
function cleanDist() {
return del(['dist/*', 'tmp/*']);
}
// Watch if markdown, less, html or image files have changed
// so as to relaunch the build into dist directory
// Should be used for dev purpose
function watch() {
gulp.watch('content/md/**/*.md', gulp.series('create-dist'));
gulp.watch('content/*.json', gulp.series('create-dist'));
gulp.watch('styles/*.less', gulp.series('create-dist'));
gulp.watch('src/**/*.handlebars', gulp.series('create-dist'));
gulp.watch('content/img/*', gulp.series('create-dist'));
gulp.watch('content/updates/*', gulp.series('create-dist'));
gulp.watch('content/updates/**/*.md', gulp.series('create-dist'));
gulp.watch('content/whats-new/*.json', gulp.series('create-dist'));
gulp.watch('content/whats-next/*.json', gulp.series('create-dist'));
gulp.watch('content/versions-in-detail/*.json', gulp.series('create-dist'));
};
// Launch a server with dist directory exposed on it
// Should be used for dev purpose
function launchWebserver() {
return gulp.src('dist')
.pipe(webserver({
livereload: true,
directoryListing: false,
open: '/pim/serenity/',
host: '0.0.0.0',
}));
};
//gulp.task('launch-webserver', ['create-dist'], function() {});
// Build the documentation is dist directory
const createDist = gulp.series(
cleanDist,
gulp.parallel(
'less',
'copy-assets',
'landings',
'build-articles',
'build-monthly-updates-as-html',
'build-monthly-updates-as-json',
'build-whats-new-page',
'build-whats-next-page',
'build-versions-in-detail-page'
)
);
//Define tasks
gulp.task('clean-dist', cleanDist);
gulp.task('watch', gulp.series(createDist, watch));
gulp.task('launch-webserver', gulp.series(createDist, launchWebserver));
gulp.task('create-dist', createDist);
gulp.task('serve', gulp.parallel('launch-webserver', 'watch'));
module.exports = {
cleanDist,
watch,
launchWebserver,
createDist
};