Skip to content

weibeld/artboard-multi-scale

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Artboard Multi-Scale

A Sketch plugin for scaling an Artboard to multiple dimensions at once.

Logo

Description

This plugin creates scaled copies of an Artboard in arbitrary dimensions. It also names and arranges the created Artboards in a sensible way:

Screencast

The target dimensions can be specified in terms of absolute width, absolute height, and percentage relative to the base Artboard (see Dimensions below).

Installation

  1. Download the latest version (0.0.1) of the plugin: artboard-multi-scale.sketchplugin.zip
  2. Unzip the downloaded zip file
  3. Double-click on the extracted .sketchplugin file

That's it, the plugin is now installed in Sketch.

Alternatively, you can also manually copy the .sketchplugin file to the Sketch plugin location at ~/Library/Application\ Support/com.bohemiancoding.sketch3/Plugins.

To uninstall the plugin, go to Plugins > Manage Plugins... in Sketch, right-click the plugin, and select Uninstall "Artboard Multi-Scale".

Alternatively, you can also uninstall the plugin by manually removing the .sketchplugin file from the Sketch plugin location at ~/Library/Application\ Support/com.bohemiancoding.sketch3/Plugins.

Usage

The plugin is used as follows:

  1. Select an Artboard.
  2. Select Plugins > Artboard Multi-Scale or press the ⌘⇧S keyboard shortcut.
  3. Enter the desired target dimensions (see below) and hit OK.

Dimensions

The target dimensions are specified as a space-separated list of dimension specifiers. A dimension specifier specifies either the target absolute width or height, or the target percentage relative to the base Artboard.

The available dimension specifier formats are listed below:

Format Example Description
N 50 Specifies the target width (height is determined automatically)
wN w50 Specifies the target width (alias for the N format)
hN h50 Specifies the target height (width is determined automatically)
N% 50% Specifies the target percentage relative to the base Artboard (width and height are determined automatically)

Note that, in the current version of the plugin, N must be an integer.

Dimension specifiers can be freely mixed, so, for example, 50 w50 h50 50% is a valid input.

Below is a detailed example using different dimension specifiers.

Example

Consider the following input:

100 w100 h100 50%

If this is applied to an Artboard with a width of 150 and a height of 300, the result is as shown below:

Example

The dimension specifiers have the following effects:

  • 100: scales the Artboard to a width of 100 and an automatically calculated height of 200.
  • w100: scales the Artboard to a width of 100 and an automatically calculated height of 200 (alias for 100).
  • h100: scales the Artboard to a height of 100 and an automatically calculated width of 50.
  • 50%: scales the Artboard to an automatically calculated width of 75 and height of 150.

Development

To modify the plugin, follow the below steps:

Before proceeding, make sure to uninstall the plugin, in case it's currently installed.

  1. Clone the repository and cd into it:

    git clone https://github.com/weibeld/artboard-multi-scale
    cd artboard-multi-scale
  2. Create a symlink from the Sketch plugins directory to the .sketchplugin directory in the repository:

    ln -s \
      "$PWD"/artboard-multi-scale.sketchplugin \
      ~/Library/Application\ Support/com.bohemiancoding.sketch3/Plugins/artboard-multi-scale.sketchplugin

    The above effectively installs the plugin in Sketch without having to move the plugin files into the Sketch plugin directory. In this way, it's possible to work on the plugin directly from within the repository.

  3. Enable plugin script reloading in Sketch:

    defaults write com.bohemiancoding.sketch3 AlwaysReloadScript -bool YES

    The above causes Sketch to always reload a plugin before executing it so that changes are reflected immediately. If this setting is disabled (which is the default), then Sketch must be restarted in order for changes in the plugin code to take effect.

  4. Edit the plugin files in the .sketchplugin directory, and test the changes by running the plugin in Sketch.

  5. When done, uninstall the plugin by deleting the previously created symlink:

    rm ~/Library/Application\ Support/com.bohemiancoding.sketch3/Plugins/artboard-multi-scale.sketchplugin

    Do not uninstall the plugin through the Plugins > Manage Plugins... in Sketch because this deletes the .sketchplugin bundle in the repository.

About

A Sketch plugin for scaling an Artboard to multiple dimensions at once

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published