I'm working on a Sketch plug-in to better automate my workflow:
- I hit a single keyboard shortcut in a document.
- My plug-in determines which exportable layers have changed since the last export.
- It exports those layers to a temporary location.
- It runs pngcrush/optipng/etc.
- It copies the crushed files into my project's build results and/or my Xcode xcassets catalog.
Using the example Sketch Image Compressor plug-in as a guide, I've hacked together a working prototype of this. I feel like I'm using too many private methods, however:
I'd rather use
ExportSlices from the Actions API, but I need to be able to suppress the standard NSSavePanel UI and instead programmatically provide a path.
Could there be some kind of
WillExport action which allows plug-ins to specify an export path? Sketch would write the export to this path, and then call the existing
Is this something that's already doable? Can it be considered for the future?