forked from openT2T/opent2t.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
49 lines (39 loc) · 1.1 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
const beep = require('beepbeep');
const connectLr = require('connect-livereload');
const del = require('del');
const express = require('express');
const gulp = require('gulp');
const open = require('open');
const plugins = require('gulp-load-plugins')();
const runSequence = require('run-sequence');
const port = 9000;
// global error handler
var errorHandler = function (error) {
beep(2, 170);
plugins.util.log(error);
throw error;
};
// start watchers
gulp.task('watch', function () {
plugins.livereload.listen();
// reload the web server when things change in the current directory
gulp.watch('./**', { readDelay: 500 })
.on('change', plugins.livereload.changed)
.on('error', errorHandler);
});
// run express for development
gulp.task('express', function () {
var app = express();
// set up live reload
app.use(connectLr())
.use(express.static('./'));
app.listen(port);
open('http://localhost:' + port + '/');
});
// default sequence
gulp.task('default', function (done) {
runSequence(
'express',
'watch',
done);
});