-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How about inline svg? #7
Comments
Sounds very interesting! I haven't touched a ton of svg (just small things here and there) so a clear picture of how this might look and what would be most important to get right doesn't pop right into my head. Mind quickly tossing out some fake example code / painting the picture? Cheers!! |
var icon = require('images/icon.svg');
<div class="some-icon">{icon}</div> Svgs works pretty much like strings, we can just render them into a DOM, with cargo I think we can pack them into |
Hmm so for some icon.svg file
We could either have a macro that you passed the string into and it converted it into a let icon = include_string!("./icon.svg");
let svg: virtual_dom_rs::VirtualNode = str_to_vdom!(icon); Or some way to set the like... someRealDOMElement.set_inner_html(include_str!("icon.svg")); or virtual_dom_node.inner_html = include_str!("icon.svg"); Just some super raw thoughts.. In general we probably need a way to set properties on a virtual node's corresponding DOM node. Other libs/frameworks could be looked at for inspiration here. But yeah - curious about your thoughts here. |
I think inner HTML is good enough, or we can just use the HTML macro then render it with Maybe just use svgs as |
Sweet! I think it would be good to wait until someone runs into a case where they need this (or anything else that requires setting I know React uses dangerouslySetInnerHTML. Another option is that we'll inevitably eventually need a way to access the real DOM node for a virtual node (i.e. if you need to call I'd def be curious to know how other libs / frameworks handle |
Closing this for now until someone needs |
Svgs can be packed as constant strings, with a macro like
svg!
to use it.The text was updated successfully, but these errors were encountered: