Skip to content

Instantly share code, notes, and snippets.

@janily
Created May 3, 2020 03:38
Show Gist options
  • Select an option

  • Save janily/f7dcaa8e7839fd629bff25ecca9d5020 to your computer and use it in GitHub Desktop.

Select an option

Save janily/f7dcaa8e7839fd629bff25ecca9d5020 to your computer and use it in GitHub Desktop.
filter layer with sketch js api
let sketch = require('sketch')
let doc = sketch.getSelectedDocument()
let selectedLayersObject = doc.selectedLayers
let selectedLayersArray = selectedLayersObject.layers
selectedLayersArray.forEach(layer => {
//console.log(layer.layers)
layer.layers.forEach(layer => {
//console.log(layer)
if(layer.type == "Text") {
console.log('aaa')
layer.selected = true;
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment