@figma-export/output-components-as-svg
Outputter for @figma-export that exports components as svg.
With this outputter you can export all components as svg into the specified output folder.
This is a sample of the output from this Figma file:
$ tree output/
Tip: A component named icon/eye
will be exported as eye.svg
inside the icon
folder.
.figmaexportrc.js
You can easily add this outputter to your .figmaexportrc.js
:
module.exports = {
commands: [
['components', {
fileId: 'fzYhvQpqwhZDUImRz431Qo',
onlyFromPages: ['icons', 'unit-test'],
outputters: [
require('@proxy-figma-export/output-components-as-svg')({
output: './output'
})
]
}],
]
}
output
is mandatory.
getDirname
and getBasename
are optional.
const path = require('path');
...
require('@proxy-figma-export/output-components-as-svg')({
output: './output',
getDirname: (options) => `${options.pageName}${path.sep}${options.dirname}`,
getBasename: (options) => `${options.basename}.svg`,
})
defaults may change, please refer to ./src/index.ts
Install
Using npm:
npm install --save-dev @figma-export/output-components-as-svg
or using yarn:
yarn add @figma-export/output-components-as-svg --dev