Created
May 16, 2019 00:18
-
-
Save dannygarcia/88a2a6e6fac21de05594993355fe6e0c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sketch = require('sketch') | |
var document = sketch.getSelectedDocument() | |
var page = document.selectedPage; | |
var vFrom = 'v11'; | |
var vTo = 'v12'; | |
var symbols = page.layers.filter(l => l.name.indexOf(vFrom) > -1)); | |
symbols.forEach(s => { | |
s.name = s.name.replace(vFrom, vTo); | |
}); | |
// var slice = page.layers[0]; | |
// | |
// if (slice.type === 'Slice') { | |
// slice.remove() | |
// } | |
var selectedLayers = document.selectedLayers | |
var selectedCount = selectedLayers.length | |
if (selectedCount === 0) { | |
console.log('No layers are selected.') | |
} else { | |
console.log('Selected layers:'); | |
selectedLayers.forEach(function (layer, i) { | |
console.log((i + 1) + '. ' + layer.name) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment