R
R
RedSmoke_smr2019-10-29 10:28:29
JavaScript
RedSmoke_smr, 2019-10-29 10:28:29

Why is the function being called multiple times?

Hello!
Can you please tell me what is wrong with this function? Why is it giving an error when executing that the function is executed several times?

module.exports = function () {
    $.gulp.task('img:build', () => {
        return $.gulp.src(imgPATH.input)
            .pipe(cache(imagemin([
                imagemin.gifsicle({interlaced: true}),
                imagemin.jpegtran({progressive: true}),
                imageminJpegRecompress({
                    loops: 5,
                    min: 70,
                    max: 75,
                    quality: 'medium'
                }),
                imagemin.svgo(),
                imagemin.optipng({optimizationLevel: 3}),
                pngquant({quality: '65-70', speed: 5})
            ], {
                verbose: true
            })))
            .pipe($.gulp.dest(imgPATH.output));
    });
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RedSmoke_smr, 2019-10-29
@RedSmoke_smr

Got it!
For those who are interested, the working function looks like this:

$.gulp.task('img:build', () => {
        return $.gulp.src(imgPATH.input)
            .pipe(imagemin([
                imagemin.gifsicle({interlaced: true}),
                imageminJpegRecompress({
                    loops:4,
                    min: 70,
                    max: 75,
                    quality:'medium'
                }),
                imagemin.optipng(),
                imagemin.svgo(),
                imagemin.optipng({optimizationLevel: 3}),
                pngquant({quality: [0.65, 0.7], speed: 5})
            ], {
                verbose: true
            }))
            .pipe($.gulp.dest(imgPATH.output));
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question