A
A
Alexey Peresmehin2017-03-10 23:16:29
Automation
Alexey Peresmehin, 2017-03-10 23:16:29

Setting up gulp-imagemin, how to remove re-optimization?

gulp.task("images", function () {
    return gulp.src("img/**/*.{png,jpg,gif}")
        .pipe(imagemin([
            imagemin.optipng({
                optimizationlevel: 3
            }),
            imagemin.jpegtran({
                progressive: true
            })
        ]))
        .pipe(gulp.dest("img"));
})

Here is the optimization code, what needs to be added to it so that when the server is called again, it would look to see if there were any changes, and if not, then skip this step, otherwise it got tired of constantly waiting until it runs the pictures over again :) Google did not give an answer for some reason.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey B., 2017-03-10
@peresmehin

https://www.npmjs.com/package/gulp-newer
in the example is just the case with pictures

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question