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

fix: support SVGs with metadata #41

Open
hanna-skryl opened this issue Feb 23, 2023 · 2 comments
Open

fix: support SVGs with metadata #41

hanna-skryl opened this issue Feb 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@hanna-skryl
Copy link

hanna-skryl commented Feb 23, 2023

Description

Sometimes, an SVG file can include metadata, like the XML prolog and XML comments that are automatically added by Adobe Illustrator, Sketch, etc. when generating a new SVG.

In such a case, the input is considered invalid, so cache is never created and the image is not loaded.

@hanna-skryl hanna-skryl added the bug Something isn't working label Feb 23, 2023
@BioPhoton
Copy link
Collaborator

BioPhoton commented Apr 17, 2023

The svg needs to get cleaned up.

here we can do the following things:

  • add information to the docs
  • add runtime errors (in dev mode, in prod remove the checks from the bundle)
  • add a cli that cleans up the svg's

Would you be so kind and help with the docs and give me more information about how you discovered the error pls.

@hanna-skryl
Copy link
Author

There are no actual runtime errors. When supplying an SVG file containing extra meta information, what happens is the <fast-svg> element is generated as usual:

<fast-svg name="Name" size="100">
  <svg class="fast-svg" width="100" height="100" viewBox="0 0 100 100">
    <use href="#Name"></use>
  </svg>
</fast-svg>

But the anchor link in the <use> element is invalid, the referred SVG is not in the <div id="svg-cache"></div>, and it's hard to tell at which point it failed.

SVG Optimizer(SVGO) might help with cleaning up the clutter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants