-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
38 lines (34 loc) · 904 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const application = require("application");
const fs = require("uxp").storage.localFileSystem;
async function exportRendition(selection) {
const pluginFolder = await fs.getPluginFolder();
const file = await pluginFolder.createFile("exported_artboard.png", {
overwrite: true,
});
console.log(`Number of selected artboards : ${selection.items.length}`);
let renditionSettings = [
{
node: selection.items[0],
outputFile: file,
type: application.RenditionType.PNG,
scale: 2,
},
];
if (selection.items.length > 0) {
application
.createRenditions(renditionSettings)
.then((results) => {
console.log(
`PNG rendition has been saved at ${results[0].outputFile.nativePath}`
);
})
.catch((error) => {
console.log(error);
});
}
}
module.exports = {
commands: {
exportRendition,
},
};