Merge duplicate symbols in Sketch

Oscar Oto
Design + Sketch
Published in
5 min readAug 1, 2017

--

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 duplicate symbols within your whole Sketch file and linked libraries and prompt you about what to do with them.

It may also help you get rid of duplicate or similar layer&text styles, but you can find more of it in this Merge styles post.

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!

We have three different button symbols with the same name. Lets merge them!

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

Run the ‘Merge duplicates symbols’ plugin

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.

Choose which symbol you’d like to keep. The others will be removed.

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.

And that’s it! Symbols merged and instances replaced! I feel happy now :)

The plugin

Merge Duplicates is available for purchase on Gumroad. It includes:

Get Merge Duplicates on Gumroad

Works best with…

Sketch Styler assigns styles automatically to all of your unstyled layers. It will scan your Sketch files for unstyled texts and look which of the existing styles (in the file or in linked libraries) match best for them.

Give it a try and let us know how it worked for you!

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 or Invision DSM.

That’s all, folks! Hope it helps!

--

--

Oscar Oto
Design + Sketch

I design and build software. Also write about UX and design techniques, and build Figma plugins sometimes. You may also know me as oodesign.