tigt / mini-svg-data-uri

Small, efficient encoding of SVG data URIs for CSS, HTML, etc.
https://npm.runkit.com/mini-svg-data-uri
MIT License
309 stars 16 forks source link

Adjust svgToTinyDataUri return type #25

Closed AdrianFahrbach closed 4 months ago

AdrianFahrbach commented 5 months ago

What this does

This PR changes the return type of the main function from string to data:image/svg+xml,${string}. The main function always adds data:image/svg+xml, at the beginning of the returned string and therefore this type changes definitely improves the type accuracy.

Motivation

I'm using this package to generate placeholder images for my Next.js page. The Next.js image component expects the placeholder string to start with data:image/ and therefore throws an error when I pass a regular string to it. This could very well be useful when using other frameworks as well though.

tigt commented 5 months ago

@fjc0k