itgalaxy / favicons

Favicons generator for Node.js
MIT License
1.19k stars 164 forks source link

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

Open josh-hemphill opened 1 year ago

josh-hemphill commented 1 year ago

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.

andy128k commented 1 year ago

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

josh-hemphill commented 1 year ago

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 commented 1 year ago

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