-
Notifications
You must be signed in to change notification settings - Fork 48
/
gulpfile.js
68 lines (61 loc) · 1.48 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
// Copyright (c) 2017 David Kim
// This program is licensed under the "MIT License".
// Please see the file COPYING in the source
// distribution of this software for license terms.
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
var nodemon = require('gulp-nodemon');
/*
// start a local mongodb instance, then start the server
var exec = require('child_process').exec;
gulp.task('mongod', function (cb) {
exec('mongod --dbpath /data/db', function (err, stdout, stderr) {
console.log('Starting mongod');
console.log(stdout);
console.log(stderr);
cb(err);
});
})
gulp.task('nodemon', ['mongod'], function (cb) {
var callbackCalled = false;
return nodemon({
script: './server.js'
}).on('start', function () {
if (!callbackCalled) {
callbackCalled = true;
cb();
}
});
});
*/
// start the server
gulp.task('nodemon', function (cb) {
var callbackCalled = false;
return nodemon({
script: './server.js'
}).on('start', function () {
if (!callbackCalled) {
callbackCalled = true;
cb();
}
});
});
// start browsersync
var bs1 = browserSync.create("proxy1");
gulp.task('browser-sync', ['nodemon'], function () {
bs1.init({
proxy: "http://localhost:3000",
port: 3010,
ui: {
port: 3011
},
browser: ["google chrome", "safari"],
open: false
});
});
// default task
gulp.task('default', ['browser-sync'], function () {
gulp.watch(["./views/*.handlebars"], reload);
});