-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
56 lines (48 loc) · 1.29 KB
/
gulpfile.js
File metadata and controls
56 lines (48 loc) · 1.29 KB
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
const gulp = require('gulp');
const aglio = require('gulp-aglio');
const browserSync = require('browser-sync');
const rename = require('gulp-rename');
const rimraf = require('rimraf');
const ejs = require('gulp-ejs');
const reload = browserSync.reload;
const TEMPLATE_FILES = ['src/**/*'];
const BASE_FILE = 'src/index.ejs';
const BUILD_DIR = 'dest';
const APIARY_FILE = './apiary.apib';
gulp.task('combine', () => {
return gulp.src(BASE_FILE)
.pipe(ejs({},{ ext: '.md' }))
.pipe(rename('index.md'))
.pipe(gulp.dest(BUILD_DIR));
});
gulp.task('generate', ['combine'], () => {
return gulp.src(BUILD_DIR + '/index.md')
.pipe(aglio({template: 'default'}))
.pipe(gulp.dest(BUILD_DIR));
});
gulp.task('browserSync', () => {
browserSync({
logConnections: true,
logFileChanges: true,
notify: true,
port: 8088,
open: false,
server: {
baseDir: BUILD_DIR
}
});
});
gulp.task('clean', (cb) => {
rimraf(BUILD_DIR, cb);
});
gulp.task('fileWatch', () => {
gulp.watch(TEMPLATE_FILES, ['generate', reload]);
});
gulp.task('build', () => {
return gulp.src(BASE_FILE)
.pipe(ejs({},{ ext: '.md' }))
.pipe(rename(APIARY_FILE))
.pipe(gulp.dest('./'));
});
gulp.task('default', ['generate']);
gulp.task('watch', ['generate', 'fileWatch', 'browserSync']);