我在理解为什么Gulp会看到一个我未指定的目录时遇到了一些问题。
这是我的Gulp任务:
var _ = require('underscore'),
gulp = require('gulp'),
npath = require('path');
var BUILD_PATH = 'dist';
var base = [
'manifest.json',
'index.html'
];
var announce = function (event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
};
gulp.task('copy:base', function () {
return gulp.src(base)
.pipe(gulp.dest(BUILD_PATH));
});
gulp.task('default', ['copy:base']);
gulp.watch(base, ['copy:base']).on('change', announce);
这是我的输出:
[20:10:35] Finished 'copy:base' after 19 ms
[20:10:35] Starting 'default'...
[20:10:35] Finished 'default' after 33 μs
File /Users/abau/Documents/Projects/projecta/dist/ was added, running tasks... // why?
[20:10:35] Starting 'copy:base'...
[20:10:35] Finished 'copy:base' after 4.45 ms
为什么要关注 dist / 目录?我没有在任何地方指定它。另外我注意到目录 dist / 存在,不再被监视了。
谢谢!