Package Exports
- @figma-export/cli
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@figma-export/cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@figma-export/cli
Command line for @figma-export.
Install
While you can install it globally on your machine, it's much better to install it locally project by project.
npm install --save-dev @figma-export/cliNote: If you do not have a
package.json, create one before installing or runnpm init -yto automatically create ones.
Usage
export FIGMA_TOKEN=<personalAccessToken>
npx figma-export COMMANDNote: These instructions use the
npxcommand 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
Commands
help
npx figma-export helpuse-config
This command is well-explained into the project README. Look at advanced section.
components
Exports components from a Figma file
npx figma-export components FILEID
# help
npx figma-export help componentstransformers
--transformer-Toption
npx figma-export components FILEID -T TRANSFORMERA transform function receives an SVG and turns it into something new.
You can create you own:
// with promise
module.exports = options => {
return (svg) => new Promise((resolve, reject) => {
resolve(svg);
});
}// with async/await
module.exports = options => {
return async (svg) => {
return svg;
};
}or install an official transformer:
| Package | Version |
|---|---|
@figma-export/transform-svg-with-svgo |
outputters
--outputter-Ooption
npx figma-export components FILEID -O OUTPUTTERAn output function receives a list of pages, in which each page contains components.
You can create you own:
module.exports = options => {
return async pages => {
console.clear();
console.log(JSON.stringify(pages));
};
}or install an official outputter: