/figma-export

Primary LanguagePythonMIT LicenseMIT

Figma Export

Usually app developers export Figma components (icons, decorations, etc) and import them to IDE manually. The goal of this project is to make this job easier.

Exports components from any Figma document and saves them to files that can be easily imported to other applications.

Allows to export your Figma components as:

  • Image files (png, jpg, svg).
  • Xcode Asset Catalog (imageset files).
  • Iconic font (otf, ttf, woff).

Installation

  • Install Python >=3.7.

  • Mac users must install certificates for the ssl module (execute command script included in /Applications/Python).

  • Install Figma Export package:

$ pip install git+https://github.com/keeneyetact/figma-export
  • Set an environment variable FIGMA_ACCESS_TOKEN to your personal access token.

  • (Optional) otf, ttf and woff commands require the FontForge command-line interface. Run this command to check the FontForge installation on your local machine:

$ fontforge -c "print('FontForge is ready')"

Usage examples

Export all components as PNG files:

$ figma_export png DOCUMENT_ID

Export all components as Xcode Asset Catalog:

$ figma_export imageset DOCUMENT_ID

Export specific components:

$ figma_export png DOCUMENT_ID -select "/Document/Page 1"

Export components as iconic font:

$ figma_export otf DOCUMENT_ID

Each font glyph is coded by the first char from the name of the corresponding component.

DOCUMENT_ID - can be parsed from any Figma document url: https://www.figma.com/file/DOCUMENT_ID/...