Skip to content

Instantly share code, notes, and snippets.

@kostimarko
Created August 17, 2019 20:46
Show Gist options
  • Save kostimarko/95f951eb3e7e2231cfeda7936cb9b84c to your computer and use it in GitHub Desktop.
Save kostimarko/95f951eb3e7e2231cfeda7936cb9b84c to your computer and use it in GitHub Desktop.
// Work horse for exporting layers
function exportLayers(){
for(var e = 0; e< doc.layers.length; e++){
// Set the selected layer on
doc.layers[e].visible = true;
// Store layername
var layerName = doc.layers[e].name;
// Function returns a new file name
var targetFile = getNewName(layerName);
// Function returns SVG save options
svgSaveOpts = getSVGOptions();
// Save SVG
doc.exportFile(targetFile,ExportType.SVG,svgSaveOpts);
// Turn selected layer off
doc.layers[e].visible = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment