Closed wenzi0github closed 5 years ago
having same problem, new files won't pass
I had to write a custom comparison function to address this:
var hasChanged = function(stream, cb, sourceFile, targetPath) {
try {
stats = fs.statSync(targetPath); // test if the file exists
changed.compareSha1Digest(stream, cb, sourceFile, targetPath);
} catch(e) {
stream.push(sourceFile);
}
};
Is this still an active issue? This worked for me and looking at the code there is a whole section dedicated to ignoring missing files.
function fsOperationFailed(stream, sourceFile, err) {
if (err) {
if (err.code !== 'ENOENT') {
stream.emit('error', new gutil.PluginError('gulp-changed', err, {
fileName: sourceFile.path
}));
}
stream.push(sourceFile);
}
return err;
}
@sindresorhus I'm sure you're busy, just bumping this because I'm not sure if there's a reason you didn't want to include new files (seems like there is?) so not sure if I should PR to "fix" this. Maybe could be optional?
Edit: I think I might have misunderstood and all seems fine.
When I first run the
gulp-changed
in my project or I add new files in my project, the new files wouldn't pass thoughgulp-changed
, beauseThis problem can be fixed, or I have to require other plugin?
thx