sketch-import-symbols icon indicating copy to clipboard operation
sketch-import-symbols copied to clipboard

Swapping symbols

Open florianpeninon opened this issue 7 years ago • 12 comments

Hi there,

Any chance to see this swapping symbols when an existing symbol is updated? I'm willing to help on building an open-source version of this.

florianpeninon avatar Apr 10 '17 09:04 florianpeninon

Hi @florianpnn! Yes, I've actually been working on a solution that caters to this requirement, but it's been a little slow as have been busy with my day job the past couple of months - def keen on collaboration - how would you like to discuss further?

kmerc avatar Apr 10 '17 20:04 kmerc

@kmerc Let's jump on a call, it will save us time. Hit me at florian(dot)peninon(at)gmail(dot)com so we can schedule it.

florianpeninon avatar Apr 12 '17 08:04 florianpeninon

I thought about coding something like that but I am glad someone already did.

The only issue I faced so far is that it doesn't play along with nested symbols.

heymadsen avatar Apr 25 '17 14:04 heymadsen

Does the latest update to the plugin (https://github.com/kmerc/sketch-import-symbols/pull/10) solve your issue?

drewloomer avatar Jun 14 '17 13:06 drewloomer

@drewloomer Not really. When I import nested symbols the internal linking between them is gone.

screen shot 2017-06-14 at 15 59 12 screen shot 2017-06-14 at 16 05 05

heymadsen avatar Jun 14 '17 13:06 heymadsen

I just ran a test on this. The issue appears to be with symbols that have / in the name. As long as the name doesn't have a slash nested symbols appear to get updated correctly.

yourfavorite avatar Jun 14 '17 18:06 yourfavorite

Actually that may not be accurate. I seem to have actually encountered this issue when I changed the name of a symbol. If a symbol is renamed, even Import by ID seems to fail on nested symbols.

cc: @drewloomer

yourfavorite avatar Jun 14 '17 18:06 yourfavorite

I've been doing some digging on this and don't have a good fix. When importing symbols from another document, nested symbols lose their reference to their symbol master. The current code tries to get around this by looking for symbols with the same name as the instance, but that's obviously really fragile. @yourfavorite asked me to look into this further but I think it may require a pretty significant effort (if it's possible at all). I can try to work on this over the next few weeks but really don't have an ETA for a resolution. Sorry, guys.

drewloomer avatar Jun 22 '17 16:06 drewloomer

Thanks for taking a look @drewloomer. Do you have any more details you could share on what the issue is? I'm going to try reaching out to the sketch team and see if they have an idea on how we could solve this.

yourfavorite avatar Jun 22 '17 19:06 yourfavorite

I did some thinking on this @yourfavorite, and there may be an alternate way to approach what I was trying yesterday. I'll try to work on it over the weekend or early next week and get back to you. The bug may lie in my thinking, not the Sketch API.

drewloomer avatar Jun 23 '17 13:06 drewloomer

@yourfavorite Finally got around to trying to make this work. I've submitted a PR that I think does the trick: https://github.com/kmerc/sketch-import-symbols/pull/16.

drewloomer avatar Jul 18 '17 21:07 drewloomer

This issue is resolved in PR #16

yourfavorite avatar Aug 17 '17 00:08 yourfavorite