Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken for svg with "animate" elements #82

Closed
asadovsky opened this issue May 10, 2015 · 4 comments
Closed

Broken for svg with "animate" elements #82

asadovsky opened this issue May 10, 2015 · 4 comments
Assignees

Comments

@asadovsky
Copy link

svg-sprite fails for an SVG containing <circle r="0">. If I change the r value to a positive integer, it succeeds.

svg-sprite --dest out --symbol anim.svg
node_modules/svg-sprite/lib/svg-sprite/queue.js:100
    Array.prototype.push.apply(this._spriter._shapes, shape.distribute());
                                                           ^
TypeError: Cannot read property 'distribute' of undefined
    at EventEmitter.SVGSpriterQueue.remove (node_modules/svg-sprite/lib/svg-sprite/queue.js:100:57)
    at node_modules/async/lib/async.js:544:30
    at node_modules/svg-sprite/lib/svg-sprite.js:184:3
    at Object.module.exports [as svgo] (node_modules/svg-sprite/lib/svg-sprite/transform/svgo.js:80:3)
    at node_modules/svg-sprite/lib/svg-sprite.js:168:38
    at fn (node_modules/async/lib/async.js:641:34)
    at Immediate._onImmediate (node_modules/async/lib/async.js:557:34)
    at processImmediate [as _immediateCallback] (timers.js:358:17)

SVG file:

<?xml version="1.0" encoding="utf-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="8" viewBox="0 0 32 8" fill="#fff">
  <circle cx="4" cy="4" r="0"/>
</svg>
@asadovsky
Copy link
Author

I get the same error if I remove the <circle> element entirely. Digging deeper, I suspect the problem is that svgo erroneously drops this element even if it contains an animation.

@asadovsky
Copy link
Author

This was fixed in svgo 0.5.1: svg/svgo#321

However, svg-sprite for some reason hardcodes svgo version "0.5.0" instead of "^0.5.0", so it still suffers from this problem.

@jkphl
Copy link
Collaborator

jkphl commented May 10, 2015

Hi @asadovsky,

yes, SVGO 0.5.1 completely breaks all the example SVGs and tests bundled with svg-sprite (and I didn't have the time to further investigate this yet). Thanks for your patience.

Cheers,
Joschi

@jkphl jkphl self-assigned this May 10, 2015
jkphl added a commit that referenced this issue Jun 4, 2015
@jkphl
Copy link
Collaborator

jkphl commented Jun 4, 2015

As of release v1.2.0 svg-sprite now pulls in SVGO v0.5.2, which should solve your problem, right? Please let me know ...

Cheers,
Joschi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants