-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deleted file in src-directory will not be considered by gulp-newer #21
Comments
Wouldn't your |
+1 |
Could someone provide some code or an example that better reproduces the issue? It is true that the plugin doesn't "consider" deleted files. There is no state retained by the plugin at all. Every time you run it, it compares source file times to destination file times. The act of deleting a file isn't communicated in any way to the plugin. |
For example... I want to use this plugin to compress only the new images using gulp-imagemin (instead of all images), but What happen with the deleted images (in the origin)? I want to delete these automatically See my example: https://github.com/jdnichollsc/Ionic-Starter-Template/blob/master/gulpfile.js |
Can gulp-newer works with subdirectories? |
The If you delete a source file and you want the corresponding destination file to be delete it, you'd need to delete it manually, clean, or use a plugin that deletes selectively. I haven't used it, but |
yes, is correct :) |
@nimo23 See my example! 👯 #33 (comment) |
The issue is this Let us assume, our css directory has three files |-project And, let our destination look like so: |-build Notice that concatenated.css is,
let our task be defined like so:
Now, let us consider watching the css directory like so:
Run #1: No files are added or modified. SO,No files are newer than concatenated.css, so everything remains same Run #2: Let us edit a.css Run #3: Let us DELETE c.css Now, the source folder which is project/css, contains only
SO, CONCATENATED.CSS = A.CSS + B.CSS IS that correct?? BUT BUT BUT, when the Newer task is triggered on deletion of c.css, the result is CONCATENATED.CSS = A+B+C BUT hello! C is no longer there!!!!!!! then why does the gulp-newer pipe it? It shouldnt Edit: gulp-newer doesn't pipe anything down the pipline |
Well, I figured the problem is because, when you delete a file, and no other files are changed, gulp-newer doesn't pipe anything at all hence, your destination remains unedited to incorporate the deletion Any workaround for this? |
To borrow inspiration from the gulp-remember usage example, would something like the following work? gulp.task('watch', function () {
var watcher = gulp.watch(scriptsGlob, ['scripts']); // watch the same files in our scripts task
watcher.on('change', function (event) {
if (event.type === 'deleted') {
// Handled deleted file (delete the dest file maybe?)
}
});
}); |
For example, having these files in src-directory :
and this in target-directory:
Changing the content of "a.css" or putting a new file in src-directory ("c.css") will trigger gulp-newer to make a new "min.css". However, when deleting "a.css", then gulp-newer does not treat it as a change, hence "min.css" will have the content of "a.css" after running the task, even "a.css" does not exist anymore.
Would be nice, if gulp-newer is able to consider deleted files in src-dir.
The text was updated successfully, but these errors were encountered: