-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
70 lines (58 loc) · 1.98 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
var gulp = require('gulp'),
gulp_sequence = require('gulp-sequence'),
rename = require('gulp-rename'),
fileinclude = require('gulp-file-include'),
minifyjs = require('gulp-js-minify'),
less = require('gulp-less');
var webRoot = "docs/";
gulp.task('watch', gulp_sequence(['watch_html', 'watch_js', 'watch_css']));
gulp.task('watch_html', function () {
gulp.watch(['includes/*.html', 'src/**/*.html'], ['include_index', 'include_speakers', 'include_workshop']);
})
gulp.task('watch_js', function () {
gulp.watch([webRoot + 'js/*.js', webRoot + 'js/speakers/*.js'], ['minify-js-index', 'minify-js-speakers']);
});
gulp.task('watch_css', function () {
gulp.watch(webRoot + 'css/*.less', ['compile-less']);
})
gulp.task('include_index', function () {
gulp.src('src/**.html')
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest(webRoot));
});
gulp.task('include_speakers', function () {
gulp.src('src/speakers/**.html')
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest(webRoot + 'speakers/'));
});
gulp.task('include_workshop', function () {
gulp.src('src/workshop/**.html')
.pipe(fileinclude({
prefix: '@@',
basepath: '@file'
}))
.pipe(gulp.dest(webRoot + 'workshop/'));
});
gulp.task('minify-js-index', function () {
gulp.src([webRoot + 'js/*.js', '!' + webRoot + 'js/*.min.js'])
.pipe(minifyjs())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(webRoot + 'js/lib'));
});
gulp.task('minify-js-speakers', function () {
gulp.src([webRoot + 'js/speakers/*.js', '!' + webRoot + 'js/speakers/*.min.js'])
.pipe(minifyjs())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(webRoot + 'js/lib/'));
});
gulp.task('compile-less', function () {
gulp.src(webRoot + 'css/*.less')
.pipe(less())
.pipe(gulp.dest(webRoot + 'css/'))
})