title: Gulp: How to make gulp automatically delete an output file if the source has been deleted?
body: <p>I'm using <code>gulp</code> along with <code>gulp-imagemin</code> for some image optimization jobs. And I set up <code>gulp watch</code> to watch for changes once I:</p>
  
  <ol>
  <li>Add new image to the image source folder</li>
  <li>Remove an image in the image source folder</li>
  </ol>
  
  <p>So far the first one works pretty well that when a new image is added, gulp runs the task and compresses that new image; however, when I delete an image, gulp doesn't seem to do anything. Am I missing a plugin or some setup here? </p>
  
  <p>Please see my <code>gulpfile</code> below:</p>
  
  <pre><code>// gulpfile.js
  var gulp = require('gulp');
  var newer = require('gulp-newer');
  var imagemin = require('gulp-imagemin');
  
  
  var imgSrc = 'src/images/**';
  var imgDest = 'images';
  
  gulp.task('images', function() {
    return gulp.src(imgSrc)
    .pipe(newer(imgDest))
    .pipe(imagemin({
        optimizationLevel: 5,
        progressive: true,
        interlaced: true
      }))
    .pipe(gulp.dest(imgDest));
  });
  
  gulp.task('watch', function() {
    gulp.watch(imgSrc, ['images']);
  });
  
  gulp.task('default', ['images', 'watch']);
  </code></pre>