forked from jmuru/Node-Gulp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
37 lines (34 loc) · 797 Bytes
/
Copy pathgulpfile.js
File metadata and controls
37 lines (34 loc) · 797 Bytes
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
var gulp = require("gulp");
var browserSync = require("browser-sync");
var nodemon = require('gulp-nodemon');
gulp.task('browser-sync', ['nodemon'], function() {
browserSync({
proxy: "localhost:3000", // local node app address
port: 5000, // use *different* port than above
notify: true
});
});
gulp.task('nodemon', function (cb) {
var called = false;
nodemon({
script: 'app.js',
ignore: [
'gulpfile.js',
'node_modules/'
]
})
.on('start', function () {
if (!called) {
called = true;
cb();
}
})
.on('restart', function () {
setTimeout(function () {
browserSync.reload();
}, 1000);
});
});
gulp.task('default', ['browser-sync'], function () {
gulp.watch(['./views/*.handlebars'], browserSync.reload);
});