T
T
Timofey Dergachev2014-07-26 22:03:24
JavaScript
Timofey Dergachev, 2014-07-26 22:03:24

How to exclude folder from gulp-imagemin processing?

The question is in the title. The method given below leads to the fact that in general all images are not processed. I created an issue on github, the author sent it to stackoverflow.

gulp.task('default', function () {
    return gulp.src(['src/images/**', '!src/images/sprites/**'])
        .pipe(imagemin())
        .pipe(gulp.dest('dist'));
});

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Velichko, 2014-07-27
@exeto

What version is being used?
Try again like this

gulp.task('default', function () {
    return gulp.src(['./src/images/**/*', '!./src/images/sprites/**/*'])
        .pipe(imagemin())
        .pipe(gulp.dest('./dist/images'));
});

I also recommend using gulp-cache with imagemin

U
unclechu, 2014-07-26
@unclechu

Try looking away: gulp-ignore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question