mahnunchik / gulp-responsive

gulp-responsive generates images at different sizes
https://npmjs.com/gulp-responsive
MIT License
502 stars 62 forks source link

Plugin fails after first input file #142

Closed robinloeffel closed 4 years ago

robinloeffel commented 4 years ago

I have several images I'd like to resize. With the following config, I can only generate all my desired resolutions of one image, though. After the first image has gone through, it fails with the error I've attached at the bottom.

const responsive = require('gulp-responsive');

/* ... */

gulp.task('img', () => {
    return gulp.src('src/img/**/*')
        .pipe(plumber())
        .pipe(responsive({
            '*': [{
                width: 400,
                rename: { suffix: '-sm' }
            }, {
                width: 800,
                rename: { suffix: '-md' }
            }, {
                width: 1200,
                rename: { suffix: '-lg' }
            }]
        }, {
            quality: 100
        }))
        .pipe(imagemin([
            imagemin.mozjpeg(),
            imagemin.optipng({
                optimizationLevel: 7
            })
        ], {
            verbose: dev
        }))
        .pipe(gulp.dest('dist/img'))
        .pipe(filter([
            '**',
            '!**/*{apple,favicon}*'
        ]))
        .pipe(webp())
        .pipe(gulp.dest('dist/img'))
        .pipe(connect.reload());
});
~/Sites/robinloeffel 🔥 yarn gulp img
yarn run v1.22.0
$ /Users/robin/Sites/robinloeffel/node_modules/.bin/gulp img
[17:25:09] Using gulpfile ~/Sites/robinloeffel/gulpfile.js
[17:25:09] Starting 'img'...
[17:25:09] gulp-responsive: agricontrol.jpg -> agricontrol-sm.jpg
[17:25:09] gulp-responsive: agricontrol.jpg -> agricontrol-md.jpg
[17:25:09] gulp-responsive: agricontrol.jpg -> agricontrol-lg.jpg
[17:25:09] Plumber found unhandled error:
 Error in plugin "gulp-responsive"
Error
    at DestroyableTransform.through2Handler [as _transform] (/Users/robin/Sites/robinloeffel/node_modules/gulp-responsive/lib/index.js:98:14)
[17:25:10] The following tasks did not complete: img
[17:25:10] Did you forget to signal async completion?
error Command failed with exit code 1.

I use Node v12.14.1, yarn v1.22.0, gulp v4.0.2, gulp-responsive v3.0.1.

robinloeffel commented 4 years ago

Since this project seems to be inactive, even just for the moment, I've gone ahead and created a plugin for this purpose on my own: https://github.com/robinloeffel/gulp-rezzy.