The current approach for merging SVGs is to manually cut and paste and created nested SVGs. So far this has worked fine, but in the long run this was not a neat solution.
Conversion from multiple SVGs to one single SVG is handled with xml2js, and a custom made converter from JavaScript to XML. This custom parser is not yet fully completed, and its shortages are listed below.
I have encountered only one bug, where if an SVG only contained multiple <path … /> tags, the elements' placement was incorrect. This is a minor bug and will be fixed in the future.
There are many eslint-disable comments scattered around. I will eventually get around to removing those.
Finally, because SVG's <svg …> can contain multiple different attributes, they need to be transferred to the parts. This is done manually, and only for a handful of specific attributes. This should be automated somehow.
Only tested with SVGs generated via Affinity Designer.
The current approach for merging SVGs is to manually cut and paste and created nested SVGs. So far this has worked fine, but in the long run this was not a neat solution.
Conversion from multiple SVGs to one single SVG is handled with
xml2js
, and a custom made converter from JavaScript to XML. This custom parser is not yet fully completed, and its shortages are listed below.As preparation for #4 , all parts' top level elements are placed in one long list (see https://github.com/vladdeSV/me-generator/issues/4#issuecomment-841871857 for a more detailed explanation).
Issues
I have encountered only one bug, where if an SVG only contained multiple
<path … />
tags, the elements' placement was incorrect. This is a minor bug and will be fixed in the future.There are many
eslint-disable
comments scattered around. I will eventually get around to removing those.Finally, because SVG's
<svg …>
can contain multiple different attributes, they need to be transferred to the parts. This is done manually, and only for a handful of specific attributes. This should be automated somehow.Only tested with SVGs generated via Affinity Designer.