Hi,
I would like to expand small SVG icons into slightly larger SVGs with the help of Hugo’s methods. I can see two general ways to go about this:
-
Use string manipulation methods on the SVG string to decompose it and add my stuff also with string methods. Take care of the appropriate SVG structure myself.
-
Use transform.Unmarshal to parse the SVG as XML into a data structure and add my stuff there. Use transform.Remarshal to assemble the new SVG from the altered data structure.
The second way should be the more flexible and elegant one, but I’m worried about the warning which comes with transform.Remarshal. It is not intended as a general transformation tool and may be unreliable, says the documentation.
Until now, I’ve been using transform.Remarshal only to show debugging information and never had any problems. But I wonder, should I better stick to the first way and avoid transform.Remarshal for production template code?
Many thanks,
Georg