获取执行在文件列表:
http://www.thinksaas.cn/ask/question/21950/
用through2
这个插件。
var through = require('through2'); gulp.task('xx',function(){ return gulp.src('src/js/*.js') .pipe(through.obj(function(file,enc,cb){ console.log(file.relative); console.log(file.path); this.push(file); cb(); })) }).on('task_stop', () => {});
npm install gulp-print
npm install gulp-filenames
npm install gulp-filelog
npm install gulp-debug
VS Code 调试 gulp 任务
{ // Use IntelliSense to learn about possible Node.js debug attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "启动程序", "program": "${workspaceRoot}\node_modules\gulp\bin\gulp.js", "args": [ "demo" ], "cwd": "${workspaceRoot}" }, { "type": "node", "request": "attach", "name": "附加到进程", "port": 5858 } ] }
gulp.watch 监控文件增加
gulp.watch('**/*.html', {cwd: './'}, ['html']),