diff --git a/figmaExtractor/figmaWriteJson.js b/figmaExtractor/figmaWriteJson.js new file mode 100644 index 00000000..b95bda74 --- /dev/null +++ b/figmaExtractor/figmaWriteJson.js @@ -0,0 +1,20 @@ +const fs = require('fs'); + +module.exports = (json) => { + + // make sure directory is there + if (!fs.existsSync('./properties')) { + fs.mkdirSync('./properties'); + } + + // the main keys in the object are used as + // file names for the json files + const keys = Object.keys(json); + + keys.forEach((key) => { + const content = json[key]; + + fs.writeFileSync(`./properties/${key}.json`, JSON.stringify(content)); + }); + +}