-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathGruntfile.js
80 lines (76 loc) · 2.22 KB
/
Gruntfile.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
69
70
71
72
73
74
75
76
77
78
79
80
'use strict';
var path = require('path'),
open = require('opener');
module.exports = function (grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dateString: new Date().toISOString().replace(/\..*Z/, ''),
concurrent: {
dev: {
tasks: ['nodemon', 'node-inspector', 'watch'],
options: {
logConcurrentOutput: true
}
}
},
nodemon: {
dev: {
script: 'bin/www',
options: {
nodeArgs: ['--debug'],
ignore: ['node_modules/**', 'public/**'],
env: {
PORT: '3000'
},
// omit this property if you aren't serving HTML files and
// don't want to open a browser tab on start
callback: function (nodemon){
nodemon.on('log', function (event){
console.log(event.colour);
});
// opens browser on initial server start
nodemon.on('config:update', function (){
// Delay before server listens on port
//setTimeout(function () {
// open('http://127.0.0.1:3000');
//}, 1000);
});
// refreshes browser when server reboots
nodemon.on('restart', function (){
// Delay before server listens on port
setTimeout(function (){
require('fs').writeFileSync('.rebooted', 'rebooted');
}, 1000);
});
}
}
}
},
'node-inspector': {
custom: {
options: {
'web-port': 8080,
'web-host': '127.0.0.1',
'debug-port': 5858,
'save-live-edit': true,
'no-preload': false,
'stack-trace-limit': 50,
'hidden': ['node_modules']
}
}
},
watch: {
js_html: {
files: ['public/**'],
options: {
livereload: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-concurrent');
grunt.loadNpmTasks('grunt-nodemon');
grunt.loadNpmTasks('grunt-node-inspector');
grunt.registerTask('default', ['concurrent']);
};