-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Remove SVG helpers? #206
Comments
I just ran into this project, and can't wait to dig into it more, so, take my comment with a grain of salt. I use SVGs a ton, and personally I never render them out element by element in other templating languages I've used. I usually create them in some sort of design tool like Figma, and do one of two things:
So, for my 2 cents, I personally won't use the SVG helpers Gomponents provides but rather use g.El and g.Raw to create my own helper that just renders SVGs from an assets files, and optionally injects classes on it. This solution has covered 100% of my teams needs for using SVGs, and the only case I can think of it not covering, is dynamically changing the internal structure of an SVG, which is an extremely uncommon use case from my experience. |
@Nintron27, thank you for your input! I've come to more or less the same realization: A lot of the benefits of gomponents are basically lost with the SVG parts, as I do the same as you: find an SVG somewhere or create one, then paste it into I only realized this when a kind developer opened #196, and I didn't want to merge it for some reason I wasn't entirely consciously aware of. I think you've explained why better than I could, so thank you for that. With option two, would you like having an |
Because the added value of having this was very small, and I don't want to confuse people about what's properly supported, I've removed the SVG package. As #196 showed, there can easily be conflicts between HTML and SVG, and the rendering isn't really set up for anything else than HTML. It's still easy to create SVG elements: `html.SVG` exists in this repo, and the rest is often just a string that can be included using `g.Raw`. Fixes #206
For me it probably doesn't matter, since I tend to just paste the entire SVG into an assets folder, add an empty class attribute to it, and then have a helper to inject classes into that class attribute. I may even just use Go's |
Makes sense. Thanks for the answer! |
See comment at #196 (comment)
The text was updated successfully, but these errors were encountered: