2

I understand that this a noob question; I am about to import my Sketch design into Zeplin.io and I am being told that I should have slices created for my assets. I have created symbols for my icons that have a rounded pixel value for spacing. Why would I need to now create slices for the assets in my project?

I am told that I should create slices for an easy integration for development; but this seems a little redundant.

3

You need to create slices to tell whatever software you're using what is an asset and what not.

Having a symbol doesn't necessarily mean it's an asset, a symbol could be anything from a product tile to a line of text. Your software can't magically tell what you think is an asset and what not, and exporting every layer is not only redundant but doesn't always lead to the needed result.

  • This is the answer that i was writing but thought somebody better do it, since ive never used sketch. However id like to be a bit nit picky, its not so much that slices are needed assets could do the same thing, it just that you have agreed with your other pipeline that you will use slices for this. We could have agreed otherwise too. Also you can script making slices surround your assets so strictly speaking you can skip this step. But you gain flexibility by doing this. – joojaa Mar 22 '17 at 9:47
  • @joojaa I think I don't fully understand you, not everything you create is considered an asset that needs to be exported. Zeplin creates assets (logo's, icons, images etc), and information about heights, font-sizes, colors etc so a developer can start building without a need for Sketch. You don't need to export every little thing in your document, just the assets that your developer is going to need. The rest is picked up by Zeplin as well to show the features, just not as an exported asset. – Summer Mar 22 '17 at 9:53
  • 1
    All im saying that one could agree to export using any tagging mechanism. There are a host of reasons not to do so for flexibility, yes. But the agreement of what to export is in all its glory, arbitrary. So you could export based on any piece of info, its just that the pipeline has agreed to use slices for such workflows. Developers could have easily done any other decision, and you would have other problems equally valid. – joojaa Mar 22 '17 at 10:03
  • @joojaa Ah right! Yes that is correct, it could have been labelled as anything, they happened to choose slices. – Summer Mar 22 '17 at 10:15
1

Slices are just another way to export in Sketch. You can just set a layer or group or artboard or symbol to export, but using slices give you more control over padding.

It’s also worth noting that slices export based on group hierarchy.

Here’s a situation where I chose to use a slice.

Sketch slices for app icon design

I could have just set the group to export, but by using a slice, it will always crop the exported image to the same size. This is important, because the group’s contents could change, which could change the group’s bounding box size. Short version: A slice maintains the export size. Exporting on a group does not.

I like slices in Sketch.

Additional info: When I said “slices export based on group hierarchy”, that’s mostly true. They will contain the layers that are their siblings and anything deeper. Their position within their siblings is ignored though. For example, if you have a group with a slice in it, it doesn’t matter if the slice is at the top of the group, or at the bottom. They’ll both export the same contents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.