This example plugin illustrates how to listen for the SelectionChanged action, and to do something whenever the user changes the selection.
It was created using skpm. For a detailed explanation on how things work, checkout the skpm Readme.
Usage
Download the example or clone the repo:
curl https://codeload.github.com/sketch-hq/SketchAPI/tar.gz/develop | tar -xz --strip=2 SketchAPI-develop/examples/selection-changed cd selection-changed
Install the dependencies
Once the installation is done, you can run some commands inside the project folder:
To watch for changes:
Debugging
To view the output of your console.log, you have a few different options:
- Use the
sketch-dev-tools - Open
Console.appand look for the sketch logs - Look at the
~/Library/Logs/com.bohemiancoding.sketch3/Plugin Output.logfile
Skpm provides a convenient way to do the latter:
The -f option causes skpm log to not stop when the end of logs is reached, but rather to wait for additional data to be appended to the input