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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@skits/figma-tokens

v2.2.0

Published

Turn Figma design tokens into code

Downloads

46

Readme

@skits/figma-tokens

Generate Design Tokens from your Figma Files

Build Status npm latest version

Install

npm install --save-dev @skits/figma-tokens

Usage

To build or update your tokens run.

npx skits-tokens sync

Before building tokens make sure your project is configured properly - see setup below.

Setup

API Token

Create a .env file in your projects root directory and add your Figma API personal access token and Figma file ID.

FIGMA_FILE_ID="ABCDEFGH12345678"
FIGMA_TOKEN="figd_ABCDEFGH12345678"

For more info on how to generate Figma personal access tokens, you can follow this guide

Token configuration

The @skits/figma-tokens package is configured by ading a figma-tokens.yml file to the root of your project. You can run npx skits-tokens init to generate a config file after answering the prompts.

Configuration options

| Option | Description | Default | | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | | outputFileName | The name of the json file where the tokens should be generated - e.g the default value will create tokens.json file | tokens | | outputTransform | When generating the tokens file, you can choose how you want the tokens to be transformed (examples coming soon). Available options are - 'flat', 'group', 'array' | flat | | tokenFrames | A list of tokens frames that can be found in your Figma file. Currently supported token frames are - 'colors', 'typography', 'spacing' | - |

Example figma-tokens.yml file

outputFilename: tokens
outputTransform: group
tokenFrames:
  - colors
  - typography
  - spacing

Available commands

sync

Sync tokens values from your Figma file

npx skits-tokens sync

init

Convenience command for configuring the figma-tokens.yml file in your project

npx skits-tokens init

Generating tokens from your Figma board

Tokens are generated by mapping a Figma API response to a JSON output. Because of the flexibility that Figma provides when creating designs, this tool uses a pre defined structure that needs to be followed when creating frames for your tokens in Figma

Creating a token in Figma

NOTE: When naming your Figma token frames the prefix _tokens/ is required.

Example (color tokens):

  1. Create a new Frame in Figma called _tokens/colors
  2. Inside your new frame, create a new rectangle and name it primary.
  3. Add your desired fill to the rectangle

More documentation and examples coming soon!