question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with a lot of svg files

See original GitHub issue

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"

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
mklingacommented, Sep 13, 2016

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

0reactions
syriacacommented, Mar 16, 2017

@soenkekluth thanks a lot 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Most Common Problems Faced by SVG Users
1. Missing fonts · 2. Missing SVG namespaces · 3. SVG appears to be blurry or distorted · 4. Large SVG file size...
Read more >
Fixing Problem SVG Files - YouTube
Fixing Problem SVG Files. Watch later. Share. Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, try restarting ...
Read more >
SVG Files Showing as HTML Documents - YouTube
If your SVG files show up as "HTML Document" or "Chrome HTML Document," never fear! It's an easy fix of the settings in...
Read more >
Display issue when two or more SVGs are on a single ...
This problem occurs if the two images share common properties. To fix this issue, open the SVG file in Illustrator and save the...
Read more >
Error loading SVG file
Error loading SVG file. This is not a valid SVG file. I had previously gotten this error randomly and would fix by relinking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found