Command line for @figma-export
npm install @figma-export/cli> Command line for @figma-export.
While you can install it globally on your machine, it's much better to install it locally project by project.
``sh`
npm install --save-dev @figma-export/cli
> Note: If you do not have a package.json, create one before installing or run npm init -y to automatically create ones.
`sh
export FIGMA_TOKEN=
npx figma-export COMMAND
`
> Note: These instructions use the npx command to run the locally installed executables. You can drop it inside of an npm run script or you may instead execute with the relative path instead. ./node_modules/.bin/figma-export
`sh`
npx figma-export --help
This command is well-explained into the project README. Look at advanced section.
Exports components from a Figma file
`sh
npx figma-export components FILEID
#### transformers
>
--transformer -T option`sh
npx figma-export components FILEID -T TRANSFORMER
`A transform function receives an SVG and turns it into something new.
You can create you own:
`ts
// with promise
export default options => {
return (svg) => new Promise((resolve, reject) => {
resolve(svg);
});
}
``ts
// with async/await
export default options => {
return async (svg) => {
return svg;
};
}
`or install an official transformer:
@figma-export/transform-svg-with-svgo |  |
#### outputters
>
--outputter -O option`sh
npx figma-export components FILEID -O OUTPUTTER
`An output function receives a list of pages, in which each page contains components.
You can create you own:
`ts
export default options => {
return async pages => {
console.clear();
console.log(JSON.stringify(pages));
};
}
`or install an official outputter:
@figma-export/output-components-as-es6 |  |
| @figma-export/output-components-as-stdout |  |
| @figma-export/output-components-as-svg |  |
| @figma-export/output-components-as-svgr |  |
| @figma-export/output-components-as-svgstore |  |
$3
Exports styles from a Figma file
`sh
npx figma-export styles FILEIDhelp
npx figma-export styles --help
`
#### outputters
>
--outputter -O option`sh
npx figma-export styles FILEID -O OUTPUTTER
`An output function receives a list of styles.
You can create you own:
`ts
export default options => {
return async styles => {
console.clear();
console.log(JSON.stringify(styles));
};
}
`or install an official outputter:
@figma-export/output-styles-as-css |  |
| @figma-export/output-styles-as-style-dictionary |  |
| @figma-export/output-styles-as-sass |  |
| @figma-export/output-styles-as-less` |  |