figma-portal

Simple way to export figma components

Usage no npm install needed!

<script type="module">
  import figmaPortal from 'https://cdn.skypack.dev/figma-portal';
</script>

README

Package logo

Build Status npm Standard Shared Config

Simple way to export a Figma components by name:ok_hand:

figma-portal is your choice:

  • If you use and strictly adhere to the naming policy in component library
  • Explaining to the designer where to get the nodeId, teamId or fileKey is too difficult

Install

npm install figma-portal --save-dev

Usage

figma-portal extract -d DEFAULT_OUTPUT_DIR -p PROJECT_NAME -c .figma.yml

Environment variables

  • FIGMA_TOKEN - Personal or OAuth token
  • FIGMA_TEAM_ID - Id of the team to list projects from

Configuration

Create a config file - .figma.yml, and add a new description for the exported components:

# Unique name of the component within the project
- name: GitHub / Figma portal / Logo
  # Output directory if different from default
  outputDir: media
  # Output file name, if necessary (by default uses the name of the component)
  fileName: banner
  # A string enum for the image output format, can be jpg, png, svg, or pdf
  format: svg
  # A number between 0.01 and 4, the image scaling factor
  scale: 1

API

Read the API documentation for more information.