iconify / json-tools.js

Functions for manipulating Iconify JSON SVG collections (Node.js version)
MIT License
7 stars 2 forks source link

Add migration explanation to non-deprecated utils and tools #4

Open manuelmeister opened 1 year ago

manuelmeister commented 1 year ago

Hey thank you for the awesome iconify!

I'm using astro-icon which itself uses the json-tools. I noticed it still uses v1 which means that some icons are not found. I tried to migrate astro-icon to iconify v2 but struggle to understand how to move away from @iconify/json-tools to @iconify/utils and @iconify/tools. What would the maintainer of astro icon need to do, to implement v2?

cyberalien commented 1 year ago

That depends on what functions you need.

I guess you need to extract icons from IconifyJSON, then render them as SVG? Then use getIconData() to extract icons and iconToSVG() to generate SVG.

See https://docs.iconify.design/tools/utils/get-icon-data.html and https://docs.iconify.design/tools/utils/icon-to-svg.html

Code samples for both functions show exactly how it is done.