shakyShane / gulp-svg-sprites

Create SVG sprites or compile to <symbols>
MIT License
334 stars 45 forks source link

Issue with a lot of svg files #89

Closed mklinga closed 7 years ago

mklinga commented 8 years ago

Hi. I have 240 svg files in different folders and I'm getting the following error:

/opt/gulp/node_modules/async/dist/async.js:844
            if (fn === null) throw new Error("Callback was already called.");
                             ^

Error: Callback was already called.
    at /opt/gulp/node_modules/async/dist/async.js:844:36
    at SVGSprite._cleanSVGO (/opt/gulp/node_modules/svg-sprite-data/lib/svg-sprite.js:150:9)
    at /opt/gulp/node_modules/svg-sprite-data/lib/svg-sprite.js:381:18
    at nextTask (/opt/gulp/node_modules/async/dist/async.js:5021:18)
    at Object.waterfall (/opt/gulp/node_modules/async/dist/async.js:5024:9)
    at SVGSprite._processFile (/opt/gulp/node_modules/svg-sprite-data/lib/svg-sprite.js:378:11)
    at tasks.(anonymous function) (/opt/gulp/node_modules/svg-sprite-data/lib/svg-sprite.js:203:14)
    at /opt/gulp/node_modules/async/dist/async.js:3671:13
    at replenish (/opt/gulp/node_modules/async/dist/async.js:884:21)
    at /opt/gulp/node_modules/async/dist/async.js:888:13

My gulp task is the following:

gulp.task('sprite', function () {
  return gulp.src(path.join(paths.svg, '**', '*.svg'))
    .pipe(svgSprite({
      mode: 'symbols',
      preview: false,
      svg: {
        symbols: 'symbols.svg'
      }})
    )
    .pipe(gulp.dest(paths.build.svg));
});

If I run the task with less .svg files, it works correctly.

Versions:

"gulp-svg-sprites": "4.0.2",
"gulp": "3.9.1"
mklinga commented 8 years ago

I created a pull request on svg-sprite-data, which seemed to resolve this issue: https://github.com/shakyShane/svg-sprite-data/pull/5

syriaca commented 7 years ago

Thanks @mklinga, it works great. @soenkekluth you really must merge that fix !

soenkekluth commented 7 years ago

@syriaca its done. sorry have not been around much ;)

shakyShane commented 7 years ago

Thanks @soenkekluth

syriaca commented 7 years ago

@soenkekluth thanks a lot 👍