kmerc / sketch-import-symbols

Import Sketch symbols from another Sketch file into your current doc
86 stars 8 forks source link

Swapping symbols #9

Open florianpeninon opened 7 years ago

florianpeninon commented 7 years ago

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.

kmerc commented 7 years ago

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?

florianpeninon commented 7 years ago

@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.

heymadsen commented 7 years ago

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.

drewloomer commented 7 years ago

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

heymadsen commented 7 years ago

@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
yourfavorite commented 7 years ago

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 commented 7 years ago

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

drewloomer commented 7 years ago

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.

yourfavorite commented 7 years ago

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.

drewloomer commented 7 years ago

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 commented 7 years ago

@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.

yourfavorite commented 7 years ago

This issue is resolved in PR #16