forked from akeneo/pim-api-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (50 loc) · 1.46 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
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
gulp.task('clean-dist', function () {
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
gulp.task('watch', ['create-dist'], function() {
gulp.watch('content/**/*.md', ['create-dist']);
gulp.watch('content/img/**/*', ['create-dist']);
gulp.watch('content/swagger/**/*.yaml', ['create-dist']);
gulp.watch('content/beta/**/*.yaml', ['create-dist']);
gulp.watch('styles/**/*.less', ['create-dist']);
gulp.watch('src/**/*.handlebars', ['create-dist']);
});
// Launch a server with dist directory exposed on it
// Should be used for dev purpose
gulp.task('launch-webserver', ['create-dist'], function() {
return gulp.src('dist')
.pipe(webserver({
host: '0.0.0.0',
livereload: true,
directoryListing: false,
open: true
}));
});
// Build the documentation is dist directory
gulp.task('create-dist', [
'clean-dist',
'less',
'copy-assets',
'reference',
'landings',
'documentation',
'client-documentation',
'misc-documentation',
'guides',
'beta-documentation',
'beta-reference'
]);
// Main task that should be used for development purpose
gulp.task('serve', [
'launch-webserver',
'watch'
]);