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

Not every file gets proper attributes assigned? #2

Open
lkostrowski opened this issue Jun 22, 2018 · 3 comments
Open

Not every file gets proper attributes assigned? #2

lkostrowski opened this issue Jun 22, 2018 · 3 comments

Comments

@lkostrowski
Copy link

Hi

I've been using this package and spent quite a lot time debugging different behavior of some of the icons from sprite.

I discovered not every symbol gets viewBox assigned. I though, basing on source code, it could be viewBox vs viewbox, but none of them works - but only for SOME icons.

Maybe you will help me discover why is this happening?

Take this svg:

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
	 viewBox="0 0 14 14" style="enable-background:new 0 0 14 14;" xml:space="preserve">

<path style="fill:#D0021B;" d="M7.879,0.553l5.985,11.969c0.247,0.494,0.047,1.095-0.447,1.342
	c-0.139,0.069-0.292,0.106-0.447,0.106H1c-0.552,0-1-0.448-1-1c0-0.155,0.036-0.308,0.106-0.447L6.09,0.553
	c0.247-0.494,0.848-0.694,1.342-0.447C7.626,0.203,7.783,0.36,7.879,0.553z M5.985,7.989c0,0.552,0.448,1,1,1s1-0.448,1-1V4.99
	c0-0.552-0.448-1-1-1s-1,0.448-1,1V7.989z M5.985,10.988c0,0.552,0.448,1,1,1s1-0.448,1-1c0-0.552-0.448-1-1-1
	S5.985,10.436,5.985,10.988z"/>
</svg>

And the output

<symbol id="attention">

<path style="fill:#D0021B;" d="M7.879,0.553l5.985,11.969c0.247,0.494,0.047,1.095-0.447,1.342
	c-0.139,0.069-0.292,0.106-0.447,0.106H1c-0.552,0-1-0.448-1-1c0-0.155,0.036-0.308,0.106-0.447L6.09,0.553
	c0.247-0.494,0.848-0.694,1.342-0.447C7.626,0.203,7.783,0.36,7.879,0.553z M5.985,7.989c0,0.552,0.448,1,1,1s1-0.448,1-1V4.99
	c0-0.552-0.448-1-1-1s-1,0.448-1,1V7.989z M5.985,10.988c0,0.552,0.448,1,1,1s1-0.448,1-1c0-0.552-0.448-1-1-1
	S5.985,10.436,5.985,10.988z"/>
</symbol>
@kristoferjoseph
Copy link
Owner

kristoferjoseph commented Jun 22, 2018

Thanks for filing this issue. I will test this out and see what is happening.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
  <path d="M7.879.553l5.985 11.969a1 1 0 0 1-.894 1.448H1a1 1 0 0 1-.894-1.447L6.09.553a1 1 0 0 1 1.789 0zM5.985 7.989a1 1 0 0 0 2 0V4.99a1 1 0 0 0-2 0v2.999zm0 2.999a1 1 0 1 0 2 0 1 1 0 0 0-2 0z" fill="#d0021b"/>
</svg>

Wondering if this optimized version will retain the viewBox

@lkostrowski
Copy link
Author

FYI I migrated to https://www.npmjs.com/package/svg-sprite and it's fine.

I just raised this issue because of curiosity - don't know why it fails 🤔

@kristoferjoseph
Copy link
Owner

It is the structure of the svg

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

2 participants