sketch-hq / SketchAPI

The JavaScript plugin library embedded in Sketch
https://developer.sketch.com/reference/api
MIT License
842 stars 126 forks source link

APIs missing: Document Name #880

Closed matteogratton closed 1 year ago

matteogratton commented 2 years ago

The Sketch document name is not available in the current implementation.

The only way to find it is currently via:

var sketch = require("sketch");
var document = sketch.getSelectedDocument();
if (document.path) {
    documentName = normalizePaths(document.path.split("/").reverse()[0]);
    documentName = documentName.replace(".sketchcloud", "");
    documentName = documentName.replace(".sketch", "");
}