mcfedr/gulp-unused-images

enhance option to delete images of specified directory

Closed this issue · 2 comments

It would be really nice to provide a option "delete:true",
so unused images will be deleted automatically from the provided img-directory.

gulp.task('images:filter', function () {
    return gulp.src(['app/images/**/*', '.tmp/styles/**/*.css', 'app/*.html', 'app/partials/**/*.html'])
        .pipe(plumber())
        .pipe(unusedImages({delete: true, log: true}))
        .pipe(plumber.stop());
});

Another thing is, to get rid of plumber().
By providing a log-property (true, false),
deleted (unused) images will be printed in the console.

I guess, if you provide these two properties, the plugin would be more useful as it is.

Thanks in advance.

I was wanting more from this plugin too, so I decided to build my own rather than forking and hacking.

It doesn't parse html dom, but finds image files in files using a line by line / regex method.

https://www.npmjs.com/package/gulp-delete-unused-images

I'm not interested in developing this myself, but willing to look at pull requests.
Mostly because of the less than 100% reliability of this tool, i tend to use it as more of a guide.