Reputation: 12575
I have a pretty simple gulp file with a couple tasks: - Clean a folder - Copy files
I have a watch setup. I keep getting an error:
events.js:85 throw er; // Unhandled 'error' event ^ Error: ENOENT, open '/Users/gordon/Dropbox/Dev/MDR/ScribeTab/dist/font/Roboto-Regular-webfont.woff'
I don't understand whats wrong, like I said sometimes it works when I run the watch, sometimes it fails on the watch, sometimes it fails when the watch task (default) is ran after I make a change to popup.html.
Here is my complete gulpfile:
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
path = require('path'),
del = require('del')
gulp.task('default', ['clean', 'copy'])
gulp.task('clean', function(){
return del('dist/**/*');
});
gulp.task('copy', function() {
/* copy fonts */
var fonts = gulp.src('src/font/*')
.pipe(gulp.dest("dist/font"));
/* copy images */
var imgs = gulp.src('src/img/*')
.pipe(gulp.dest("dist/img"));
/* copy html files */
var html = gulp.src('src/**/*.html')
.pipe(gulp.dest("dist"));
/* copy manifest file for google chrome */
var manifest = gulp.src('src/manifest.json')
.pipe(gulp.dest('dist'));
});
// watch
gulp.task('watch', ['default'], function () {
gulp.watch(['src/popup.html'], ['default']);
});
Upvotes: 0
Views: 138
Reputation: 39018
Sounds like something may be running out of order, perhaps try copy
first then clean
Also try adding this error logging function:
function errorlog(err) {
console.log(err.message);
this.emit('end');
}
gulp.task('clean', function() {
return del('dist/**/*')
.on('error', errorlog);
});
Upvotes: 1