-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
60 lines (51 loc) · 1.25 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
global.gulp = require('gulp');
global.$ = require('gulp-load-plugins')();
var argv = require('yargs').options(
{
'p': {
alias: ['prod'],
boolean: true
},
'l': {
alias: ['live', 'reload'],
boolean: true
}
}
).argv;
global.prod = argv.p;
global.live = argv.l;
global.distDir = prod ? 'dist/prod' : 'dist/dev';
//var requireDir = require('require-dir');
//requireDir('./tasks');
if (live) {
global.sync = require('browser-sync').create();
gulp.task('default', ['nodemon'], function (cb) {
sync.init({
ghostMode: false,
open: false,
notify: false,
online: false,
port: 9000,
proxy: "localhost:9001"
//// to run simple static server, use:
//server: {
// baseDir: ['app']
//}
}, cb);
});
var nodemon = require('nodemon');
gulp.task('nodemon', function (cb) {
nodemon({
script: 'server/index.js',
watch: ['server'], // FIXME open bug when pointing to node_modules, see https://github.com/remy/nodemon/issues/4873
ext: 'js',
env: {
NODE_ENV: prod ? 'production' : 'development',
APP_DIR: 'app',
PORT: 9001,
LIVE: live, //(always true)
LIVE_PORT: 9000
}
}).once('start', cb);
});
}