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

SVG loader fails with missing viewBox #13280

Open
1 task
adamalfredsson opened this issue Feb 20, 2025 · 0 comments
Open
1 task

SVG loader fails with missing viewBox #13280

adamalfredsson opened this issue Feb 20, 2025 · 0 comments
Labels
needs triage Issue needs to be triaged

Comments

@adamalfredsson
Copy link

Astro Info

Astro                    v5.3.0
Node                     v20.12.2
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/svelte
                         @astrojs/react
                         astro-icon

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I want to use an SVG pattern which doesn't have a viewBox, such as this one:

<svg width="200" height="100%">
  <defs>
    <pattern id="stripes" patternUnits="userSpaceOnUse" width="10" height="10">
      <rect width="5" height="10" fill="#000" />
    </pattern>
  </defs>
  <rect width="100%" height="100%" fill="url(#stripes)" />
</svg>

But, using the experimental svg loader, I get error:

NoImageMetadata
Could not process image metadata.

With astro-icon v0 this was no problem
With astro-icon v1 I could override the viewBox property, by setting it to undefined on the Icon component

What's the expected result?

SVG should load

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-gjg3z579

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant