From 16e6a4319c30490ec05b0fe2da6338d43cb2b3ae Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Tue, 3 Sep 2019 16:26:25 -0600 Subject: [PATCH] resolves #98 ignore image optimizer if not available --- gulp.d/tasks/build.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/gulp.d/tasks/build.js b/gulp.d/tasks/build.js index c2b502b..9979f91 100644 --- a/gulp.d/tasks/build.js +++ b/gulp.d/tasks/build.js @@ -19,8 +19,6 @@ const postcssVar = require('postcss-custom-properties') const uglify = require('gulp-uglify') const vfs = require('vinyl-fs') -imagemin.noop = (buffer) => Promise.resolve(buffer) - module.exports = (src, dest, preview) => () => { const opts = { base: src, cwd: src } const sourcemaps = preview || process.env.SOURCEMAPS === 'true' @@ -77,11 +75,11 @@ module.exports = (src, dest, preview) => () => { .src('img/**/*.{gif,ico,jpg,png,svg}', opts) .pipe( imagemin([ - imagemin.gifsicle() || imagemin.noop, - imagemin.jpegtran() || imagemin.noop, - imagemin.optipng() || imagemin.noop, + imagemin.gifsicle(), + imagemin.jpegtran(), + imagemin.optipng(), imagemin.svgo({ plugins: [{ removeViewBox: false }] }), - ]) + ].reduce((accum, it) => it ? accum.concat(it) : accum, [])) ), vfs.src('helpers/*.js', opts), vfs.src('layouts/*.hbs', opts), -- 2.11.0