From e0a1ad31733b8022068bddd948c0693e2ae893cb Mon Sep 17 00:00:00 2001 From: feerglas Date: Mon, 7 Sep 2020 18:02:30 +0200 Subject: [PATCH] feat: add workflow to save svg's --- figmaExtractor/figmaWriteSvgData.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 figmaExtractor/figmaWriteSvgData.js diff --git a/figmaExtractor/figmaWriteSvgData.js b/figmaExtractor/figmaWriteSvgData.js new file mode 100644 index 00000000..f68d252a --- /dev/null +++ b/figmaExtractor/figmaWriteSvgData.js @@ -0,0 +1,18 @@ +const fs = require('fs'); + +module.exports = (iconData, config) => { + + // make sure directory is there + const outputFolder = `./${config.output.folder}`; + + if (!fs.existsSync(outputFolder)) { + fs.mkdirSync(outputFolder); + } + + iconData.forEach((icon) => { + fs.writeFileSync(`${outputFolder}/${icon.name}.svg`, icon.svg); + }); + + console.log('SVG INFO: saved svg\'s'); + +}