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

Fails on SVG assets without width and height properties #38

Closed
kyleolsondesign opened this issue Jan 27, 2015 · 5 comments
Closed

Fails on SVG assets without width and height properties #38

kyleolsondesign opened this issue Jan 27, 2015 · 5 comments

Comments

@kyleolsondesign
Copy link

Using a tool like Adobe Illustrator to create SVG assets, you get output that does not include width or height properties. Here is a sample of that output, after being compressed with imagemin:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="-15.6 130.7 612 507" enable-background="new -15.6 130.7 612 507"></svg>

Running through the w3c validator, this is valid SVG 1.1.

But when I run through sizeOf, I get the following error:

Uncaught TypeError: invalid svg

If I manually add the width and height attributes, sizeOf works as expected:

<svg xmlns="http://www.w3.org/2000/svg" width="612" height="507" viewBox="-15.6 130.7 612 507" enable-background="new -15.6 130.7 612 507"></svg>

The width and height attributes are described in the viewBox attribute already, as the last two values. I suggest pulling from those values if the width and height attributes are not present.

@borodean
Copy link
Contributor

@kyleolsondesign would be fixed when #36 is merged.
/cc @netroy

@mdmoreau
Copy link

Any updates on this? Would be great to get it added in.

@rlee1121
Copy link

+1

1 similar comment
@tiroxis
Copy link

tiroxis commented Oct 6, 2015

+1

@shinnn
Copy link
Contributor

shinnn commented Nov 23, 2015

#36 is merged.

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

No branches or pull requests

6 participants