-
Notifications
You must be signed in to change notification settings - Fork 52
/
gulpfile.js
executable file
·53 lines (44 loc) · 1.31 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
var gulp = require('gulp'),
folderIndex = require('gulp-folder-index'),
browserSync = require('browser-sync').create(),
source = './docs/',
dest = './docs/'
function html() {
return gulp.src(dest + '**/*.html')
}
function js() {
return gulp.src(dest + '**/*.js')
}
function styles() {
return gulp.src(dest + '**/*.css')
}
function slides() {
return gulp
.src(source + 'slides/**/*.md')
.pipe(
folderIndex({
extension: '.md',
filename: 'index.json'
})
)
.pipe(gulp.dest(source + 'slides'))
}
function watch() {
gulp.watch(source + 'js/**/*.js', js).on('change', browserSync.reload)
gulp.watch(source + 'css/**/*.css', styles).on('change', browserSync.reload)
gulp.watch(source + 'index.html', html).on('change', browserSync.reload)
gulp.watch(source + 'slides/**/*.md', slides).on('change', browserSync.reload)
}
function server() {
browserSync.init({
notify: false,
server: {
baseDir: source
}
})
gulp.watch(source + 'css/**/*.css', styles).on('change', browserSync.reload)
gulp.watch(source + 'index.html', html).on('change', browserSync.reload)
gulp.watch(source + 'slides/**/*.md', slides).on('change', browserSync.reload)
}
var build = gulp.series(gulp.parallel(slides, js, styles, html), server, watch)
gulp.task('default', build)