Does Illustrator support template literals?
Hi,
I have an illustrator file with all of my icons, and a script that generates all the png assets for me. I would like it to also generate Contents.json files for iOS integration. In order to do that, I would like to utilize a feature like template literals, but I can't get it to work. I have tried with both 'let' and 'const' but the values don't update in the template. Any help would be greatly appreciated.
function mkContents(txt)
{
let name = 'back';
let size = '24';
var Path = app.activeDocument.path;
var saveFile = File(Path + "/" + "Contents" + ".json");
if(saveFile.exists)
saveFile.remove();
saveFile.encoding = "UTF8";
saveFile.open('w');
saveFile.writeln(txt);
saveFile.close();
}
let template = '''{
"images" : [
{
"filename" : "ic_${ name }-${ size }@1x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "ic_${ name }-${ size }@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "ic_${ name }-${ size }@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}''';
mkContents(template);
