SVG export doesn't include empty rectangles used for padding

Hi,

We’re moving over to Figma and the plugin API has been great so far in bridging the gap between design and development. We export SVGs that are tagged and populated with data dynamically.

However, there is one one use case where Figma’s export behaviour is stopping us from migrating completely.

Sometimes we want to iterate over rows that are SVG g elements. Within these we use empty rectangles/vectors as padding that we want to be maintained in between rows once the SVG is exported. I can’t find a way to do this without giving these nodes a stroke or fill within the Figma canvas. Moreover, the group itself shrinks to the size of its children, so I can’t get the parent node to hold the width/height instead.

I’ve tried intercepting these nodes directly from canvas using figma.currentPage.selection, but I can’t even see them there.

I understand that we could enforce a naming system where the rectangle/vector’s fill & stroke are removed from the export SVG within the plugin as part of our formatting, but this feels a little hacky and we’re looking to reduce the manual workload of designers.

This is related to this issue and I can’t see an anywhere on if it was solved.

Would really appreciate it if anyone has any advice!
Thanks

1 Like

If you select a frame with these items inside, only the frame itself will be included in selection array. To find these items you need to get the children of the frame.

Ok great, will give that a try - thanks!