@@ -170,6 +170,40 @@ module.exports = function (grunt) {
170
170
}
171
171
} ,
172
172
173
+ // Debugging with node inspector
174
+ 'node-inspector' : {
175
+ custom : {
176
+ options : {
177
+ 'web-host' : 'localhost'
178
+ }
179
+ }
180
+ } ,
181
+
182
+ // Use nodemon to run server in debug mode with an initial breakpoint
183
+ nodemon : {
184
+ debug : {
185
+ script : 'server.js' ,
186
+ options : {
187
+ nodeArgs : [ '--debug-brk' ] ,
188
+ env : {
189
+ PORT : process . env . PORT || 9000
190
+ } ,
191
+ callback : function ( nodemon ) {
192
+ nodemon . on ( 'log' , function ( event ) {
193
+ console . log ( event . colour ) ;
194
+ } ) ;
195
+
196
+ // opens browser on initial server start
197
+ nodemon . on ( 'config:update' , function ( ) {
198
+ setTimeout ( function ( ) {
199
+ require ( 'open' ) ( 'http://localhost:8080/debug?port=5858' ) ;
200
+ } , 500 ) ;
201
+ } ) ;
202
+ }
203
+ }
204
+ }
205
+ } ,
206
+
173
207
// Automatically inject Bower components into the app
174
208
'bower-install' : {
175
209
app : { < % if ( jade ) { % >
@@ -386,6 +420,15 @@ module.exports = function (grunt) {
386
420
'compass'< % } else { % >
387
421
'copy:styles' < % } %>
388
422
] ,
423
+ debug : {
424
+ tasks : [
425
+ 'nodemon' ,
426
+ 'node-inspector'
427
+ ] ,
428
+ options : {
429
+ logConcurrentOutput : true
430
+ }
431
+ } ,
389
432
dist: [< % if ( coffee ) { % >
390
433
'coffee',< % } % > < % if ( compass ) { % >
391
434
'compass:dist',< % } else { % >
@@ -465,6 +508,16 @@ module.exports = function (grunt) {
465
508
return grunt . task . run ( [ 'build' , 'express:prod' , 'open' , 'express-keepalive' ] ) ;
466
509
}
467
510
511
+ if (target === 'debug') {
512
+ return grunt . task . run ( [
513
+ 'clean:server' ,
514
+ 'bower-install' ,
515
+ 'concurrent:server' ,
516
+ 'autoprefixer' ,
517
+ 'concurrent:debug'
518
+ ] ) ;
519
+ }
520
+
468
521
grunt.task.run([
469
522
'clean:server',
470
523
'bower-install',
0 commit comments