Js file

  node.js, question

Can you tell me how the gulpfile.js file can run under chrome so that you can interrupt some debugging? Because the code was written by someone else. There is no comment, so I want to debug it and see how it works.

Such as@ sesame flyingStudents said that gulp is actually a node program, so you can debug gulp as you debug node.

1. install node-inspector

npm install -g node-inspector

2. use node debug.

node-debug $(which gulp) myTask

3. Just visit chrome according to the prompt information.

In addition, if you need to suspend your Gulpfile program, you need to add debugger to gulpfile.js;

gulp.task('myTask', function() {
 debugger;
 gulp
 .src('myPath/files/**/*')
 .pipe(someAction())
 .pipe(gulp.dest('newPath/files'));
 });

Another way is to use iron-node.

http://s-a.github.io/iron-node/
https://github.com/s-a/iron-node/blob/master/docs/DEBUG-NODEJS-COMMANDLINE-APPS.md