Merge duplicate symbols in Sketch

Oscar Oto
Oscar Oto
Aug 1, 2017 · 4 min read

Ever worked in a brand new Sketch project, and realise that you can import somehow artboards or symbols from another project to save some time? Or collaborating with some other designers in different Sketch files, and willing to integrate your work? Sounds like a good idea. Copy/Paste. Nothing could go wrong. But it does… sure it does :) .

Sketch allows you to have different symbols with the same name, and there’s no way to overwrite one with the other.

Many things go wrong. Overrides are not kept, some fonts need to be replaced, you get in a duplicated styles nightmare, correlative symbols (the ones with the same size you use to do symbol overriding) are not imported, … , but what annoys me the most is that when you import a molecule or organism from another project, every related symbol (and nested symbols), is imported too, which results in different symbols with the same name in your Symbols page.

When importing work from anywhere else, there’s a high probability of getting duplicated symbols in your own file.

Say in ‘Origin.sketch’ you already have a symbol called ‘Icons/WriteIcon’ which is used in a button. If you now import (from ‘OtherSource.sketch’) an ‘InputField’ symbol that has, in its contents, a nested symbol called ‘Icons/WriteIcon’ too, Sketch will add to your symbols page the ‘InputField’ symbol, but also the related ‘Icons/WriteIcon’ of the other document.

Then everything messes up… You may imagine that when needing to insert the Compose symbol somewhere, you’ll find two options and have to decide which one is the right one.

But the real problem is that some of your artboards may have a reference to the first ‘Icons/Compose’ symbol, and some others to the second one. And it becomes really hard to maintain.

Some artboards will be referencing the first symbol, and some will be referencing the second one. Boom -> Maintainability nightmare :)

We use to face this issue in early stages of our designs when working in a team. It happens quite often with icons and with some atom symbols.

So we developed an Sketch plugin to solve the problem :)

Merge duplicates

The Merge duplicates plugin will automatically find all the name-duplicated symbols within your whole Sketch file (even in different pages) and prompt you about what to do with them.

For every duplicated symbol, it will ask you which symbol you’d like to keep. The other symbols will be removed, and all of their instances will be replaced by the one you chose to keep.

Say you have three different cards with three different buttons in them. Each button is a symbol, and somehow those three symbol buttons have the same name. Let’s merge them!

Simply run the “Merge duplicate symbols” plugin from the Plugins menu.

The plugin will find automatically all symbols with the same name and ask you, for each of them, what to do. Choose the one you want to keep and press OK. The other symbols with the same name will be removed, and all of their instances will be replaced by the one you chose to keep.

If you don’t want to merge the symbols, just skip it by clicking on “Don’t merge this one”.

And that’s it! Symbols are merged. The discarded ones are removed, and all of their instances are replaced by the new one.

Just a couple of considerations:

The plugin works the same way as the “Replace with” Sketch built-in feature. This means that, as it happens with “Replace with”, all symbol overrides will be lost on the instances that are replaced.

The plugin is intended to merge symbols that have the same name. We’ll soon release an update in which you could select manually the symbols that you’d like to merge, but for now… you may do the trick by renaming them so that they have the same name.

The plugin

Merge Duplicates is available for purchase on Gumroad.

Conclusions

Importing raw symbols from other files can be a mess. This plugin will hopefully ease the process and help you keep your Sketch files clean.

Anyway, if you’re facing this same issue quite often, you probably could make use of a design system, or some other collaboration or integration methods, such like Abstract, Plant, or Picnic. Even Craft Library and Brand.ai would help you avoid this kind of integrations and merging.

That’s all, folks! Hope it helps!

Design + Sketch

The best collection of articles, tips, tutorials, and stories on designing and prototyping with Sketch and beyond

Oscar Oto

Written by

Oscar Oto

UX Designer and UI Dev. Lego® Serious Play® facilitator. Sketch plugin developer. Love bridging UX and Dev teams.

Design + Sketch

The best collection of articles, tips, tutorials, and stories on designing and prototyping with Sketch and beyond

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade