Skip to content

Instantly share code, notes, and snippets.

@philsinatra
Created December 21, 2016 15:21
Show Gist options
  • Save philsinatra/b0533fb3a7bd5698f2ea283c426ff4c3 to your computer and use it in GitHub Desktop.
Save philsinatra/b0533fb3a7bd5698f2ea283c426ff4c3 to your computer and use it in GitHub Desktop.
The default Custom Plugin script that comes with Sketch
log('This is an example Sketch script.');
var documentName = context.document.displayName();
log('The current document is named: ' + documentName);
var selectedLayers = context.selection;
var selectedCount = selectedLayers.count();
if (selectedCount == 0) {
log('No layers are selected.');
} else {
log('Selected layers:');
for (var i = 0; i < selectedCount; i++) {
var layer = selectedLayers[i];
log((i + 1) + '. ' + layer.name());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment