-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
48 lines (39 loc) · 1.35 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
var gulp = require("gulp");
var gutil = require('gulp-util');
var shell = require('gulp-shell');
var runSequence = require('run-sequence');
var livereload = require('gulp-livereload');
var IS_PRODUCTION_BUILD = process.argv.indexOf('--production') >= 0 || false;
gulp.task("default", ["main-task"]);
gulp.task("main-task", function() {
runSequence(['serve-files', 'reload-changes', 'transpile-javascript']);
});
gulp.task("serve-files", shell.task([
'http-server ./public -s'
]));
gulp.task("reload-changes", ['reload-html', 'reload-js', 'reload-misc'], function() {
livereload.listen({start: true});
gulp.watch('src/**/*.html', ['reload-html']);
gulp.watch('public/**/.js', ['reload-js']);
});
gulp.task("transpile-javascript", shell.task([
'webpack --watch --colors --progress ' + (IS_PRODUCTION_BUILD ? '--production' : '')
]));
gulp.task("reload-html", function() {
gulp.src('src/**/*.html')
.pipe(gulp.dest('public'))
.pipe(livereload());
gulp.src('src/**/*.ico')
.pipe(gulp.dest('public'))
.pipe(livereload());
});
gulp.task("reload-js", function() {
gutil.log('JavaScript files changed.');
livereload.reload();
});
gulp.task("reload-misc", function() {
gulp.src('src/data/**/*.*')
.pipe(gulp.dest('public/data'))
.pipe(livereload());
livereload.reload();
});