Open
Description
I have a really small plugin that works fine, but when I use skpm to publish it, a bunch of extra code is added to the .sketchplugin file and causes it not to work. I'm using skpm so that it'll update in the Sketch Plugin library, but I don't need all the template stuff.
Sketch DevTools shows this when I run my plugin:
MOJavaScriptException: Error: Missing export named "inPage". Your command should contain something like `export function " + key +"() {}`.
I'm not sure why though, my plugin works fine when I run it directly from the plugin file before doing skpm build
; this is all it is:
// Counts the number of artboards in the Sketch file
function inFile(context) {
var sketch = require('sketch');
var doc = context.document;
const documentData = sketch.getSelectedDocument().sketchObject.documentData();
var countFile = (documentData.allArtboards().count());
doc.showMessage("This document has "+ countFile +" artboards");
}
// Counts the number of artboards in the current page
function inPage(context) {
var sketch = require('sketch');
var doc = context.document;
const currentPage = sketch.getSelectedDocument().selectedPage.sketchObject;
var countPage = (currentPage.artboards().count());
doc.showMessage("This page has "+ countPage +" artboards");
}
I'm not a developer and have been stumbling my way through all this; any help is appreciated 😅
Metadata
Metadata
Assignees
Labels
No labels