Is there a way to check if a layer is an imported SVG?

Hi.

I’m new to XD plugin development.

I need to write a command to mark bitmaps and imported SVGs for export.

To identify a bitmap, I’m checking if the fill property is of type ImageFill.

But how to check if the layer is an imported SVG?

Regards,
JC

1 Like

Hi @Joao,

Welcome to the community :wave: :wink: .

Unfortunately, I don’t think it’s possible to “detect” imported SVGs. The thing is that XD “converts” SVGs to native XD layers when importing them, and I don’t believe that there’s any metadata that can be used to consistently detect whether any given layer has been imported as SVG.

While this probably isn’t the answer you’re hoping for, I hope it still helps.

Best,
Pablo

1 Like

Hi, @pklaschka! Thanks a lot!

I was kind of hoping the answer was that.

My solution was to prefix the SVG files I import and then identify them by name. For example: all of my icons start with “icon_”.

But it would be great if the XD team added this functionality to automatically mark all bitmaps and SVGs to be exported. I am working with two documents that have thousands of layers and it is very difficult to keep checking these type of assets all the time to be exported every time I change or add something to the document.

Regards,
JC

1 Like