unplugin / unplugin-icons

šŸ¤¹ Access thousands of icons as components on-demand universally.
https://www.npmjs.com/package/unplugin-icons
MIT License
3.66k stars 131 forks source link

Invalid HTML attributes rendered using Astro + Preact #268

Open moritzlang opened 1 year ago

moritzlang commented 1 year ago

Describe the bug

Hey!

I encountered a problem when rendering an icon in a Preact component using Astro. In the StackBlitz project you can see that the rendered SVG contains attributes in camel-case (strokeWidth instead of stroke-width), which causes a visual bug since the HTML is not valid.

Any idea on how to fix this?

Thanks for your help! Moritz

Reproduction

https://stackblitz.com/edit/github-wpq4zq?file=astro.config.mjs

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 16.14.2 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 7.17.0 - /usr/local/bin/npm

Used Package Manager

npm

Validations

userquin commented 1 year ago

It seems a problem with Astro: https://stackblitz.com/edit/github-wpq4zq-wuz3k4?file=src%2Fpages%2Findex.astro

imagen