Does the Sketch app provide something like a "resize artboard to content" command? If yes, where can I find it?
This question has not been accepted and I think what OP were looking for is resize the artboard to fit to the content with it, and thus it got no answer so far.
While I don't know when this feature had been available, but in Sketch 3.7, you can achieve it exactly. Just select the artboard and on the Inspector, click on the
Resize to Fit. Sketch automatically resize the artboard to fit to the content.
FYI, my suggestion is an extension to Jagrat Jagz Desai's method. It's not fully automated but does save you the step of checking the size of your content in order to create an artboard at that exact size.
- in the Layers List on screen left, select the artboard that corresponds to your content
- delete artboard and hit 'Keep Layers' button when prompted
- highlight content, then insert new artboard (A)
- select 'Around Selection' option in the Inspector on screen right
Having not previously found a good solution to this problem, I went and built a plugin to do just that.
Summary of features
- Hitting Ctrl+Shift+Z resizes the parent artboard of your currently selected layer. You can also resize one or more selected artboards (or the parent artboards of one or more selected child layers) all at once.
- Resize all the artboards on the current page with Cmd+Ctrl+Shift+Z. However, if you have a very large Sketch file with tons of artboards on the page, I'm not sure what kind of performance impact that'll have.
- The relative positioning of all layers on the artboard is always preserved
- The positioning of the artboard's layers with respect to the artboard's top-left corner will only consider visible layers. That means if a hidden layer is sticking out to the left of the visible layers, when you resize the artboard it will stick out the left side of the artboard's X axis.
- The artboard itself is never moved relative to other artboards on the page
Let me know (preferably on Github) if you have any comments or feedback!