favicons icon indicating copy to clipboard operation
favicons copied to clipboard

Option to return un-stringified elements for use in plugins and other libraries

Open josh-hemphill opened this issue 1 year ago • 3 comments

When writing front-end tooling plugins, I need to track the individual tags/elements and their attributes for when html regenerates.

I think the easiest thing to do would be to make it possible to get back the html elements as objects. I can probably put together a PR pretty quick, just want to see if there'd be any interest in merging first.

josh-hemphill avatar Oct 29 '23 06:10 josh-hemphill

That's great idea. The only concern I have is how to do this and not break existing API.

andy128k avatar Oct 29 '23 10:10 andy128k

I started experimenting, and while it took a little more modification than I thought to get the types to automatically resolve, it's still just an additional flag in the options that defaults to still returning the html as a string, so I'm not sure if there'd really be anything breaking other than maybe if some people are doing other things like re-exporting the types. 🤔

If you mean not changing the options at all, then I could expose it as a separate export maybe. 🤷

josh-hemphill avatar Oct 29 '23 10:10 josh-hemphill

I forked and branched with what I have so far: https://github.com/josh-hemphill/favicons/tree/html-obj-return

josh-hemphill avatar Oct 29 '23 10:10 josh-hemphill