npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

figma-extract-token

v0.2.14

Published

Compose and Extract design tokens from Figma

Downloads

148

Readme

Figma extract token

A simple way to extract token's component from Figma and convert to your front-end project. Documentation

stars Downloads Version size MIT License

yarn add figma-extract-token

npm i figma-extract-token

Features

  • Extract foundation styles from API Figma and convert to tokens.
  • Extract components style composed by inheritance from foundation tokens.
  • Compose multiple format of extraction SCSS, Typescrit, ES6, Android, IOS and so on with Style dictionary.
  • Auto versioning controller, know what really changes from the last extraction.
  • Create change log of designers comments on library versioning.
  • Automate the token extraction with webhook and automated publish of library.
  • Create a dicionary name for the variable composition.
  • Works with most css-in-js libraries, composition inspired by Styled system.

Try It Out

Try the examples

Table of contents

Concept

This extractor is based on Foundations and Components, where the Design is the responsable to create token names, deprecated status, component comment and composition. The Developers should only create the extractor mapper and Run the script, all files generated by the extractor should not be modify by the developer.

To see more check it out Documentation

Usage

Figma configuration

  • First on Figma, create at a document based on this Figma Example, is required to compose two pages Foundation and Components.
  • Keep the document IDm you're going to need to run the script, you can find on url www.figma.com/file/PodXJDGjtBAdWiWtbrNtIP/...
  • Generate and keep a personal token, you can find on Main menu/ Help and account / account settings

Dictionary configuration

{
  "source": ["build/**/*tokens.json"],
  "platforms": {
    "scss": {
      "transformGroup": "scss",
      "buildPath": "build/scss/",
      "files": [{
        "destination": "_tokens.scss",
        "format": "scss/variables"
      }]
    }
  }
}

That file is responsable to compose the extraction of component to a file for your project. More examples of dictionary configuration check it out on Style dictionary Config

Figma extractor configuration

{
  "outDir": "./build",
  "dictionaryConfig": "./dictionary.config.json",
  "foundation": {
    "name": "Foundation",
    "children": {
      "Letter Spacing": {
        "extract": ["letterSpacing"]
      },
      "Color": {
        "extract": ["fills"]
      }
    }
  },
  "components": {
    "name": "Components",
    "inheritance": {
      "fills":  "color",
      "letterSpacing": "letterSpacing"
    }
  }
}

Run the command

Run examples: Add a environments var with you figma token:

export PERSONAL_TOKEN=123123...
cd example/advanced
yarn
yarn start
cd example/basic
yarn
yarn start

Extraction:

figma-extract-token--token=PERSONAL_TOKEN --document=DOCUMENT_ID --config=figma.config.json

Build:

yarn build

Dev:

yarn dev

Lint:

yarn lint

Test:

yarn test

Format:

yarn format

To learn more, see the Getting Started guide or read the docs.

Docs


Further Reading

To Do

Related

To Do

Feedback

Any questions or suggestions?

You are welcome to discuss it on:

Tweet