ben-eb/gulp-svgmin

Error being returned on plugin

BenjaminRCooper opened this issue · 2 comments

When running my task, gulp throws this error:

Possibly unhandled Error in plugin 'gulp-svgmin' Non-whitespace before first tag. at /Users/myuser/Documents/MVP/node_modules/gulp-svgmin/index.js:59:45 at /Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/lib/svgo.js:32:13 at Object.sax.onerror (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/lib/svgo/svg2js.js:120:9) at emit (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/node_modules/sax/lib/sax.js:615:33) at error (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/node_modules/sax/lib/sax.js:644:3) at strictFail (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/node_modules/sax/lib/sax.js:662:22) at Object.write (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/node_modules/sax/lib/sax.js:935:11) at module.exports (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/lib/svgo/svg2js.js:131:9) at SVGO.optimize (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/node_modules/svgo/lib/svgo.js:29:5) at Transform.stream._transform (/Users/myuser/Documents/MVP/node_modules/gulp-svgmin/index.js:57:14)

My task can be seen here:

gulp.task('svgCompress', function () { return gulp.src('app/images/**/*.svg') .pipe($.svgmin()) .pipe($.size()); });

Hi, I think you have a malformed SVG that is causing the task to fail. Please see this issue for some guidance on possible solutions: svg/svgo#123

Thanks :)