Consumes Figma Tokens Studio (Formerly Figma Tokens) output files, and serializes the tokens to CSS variables to be used in your projects and design systems.
You can, for example, hook Figma Tokens Sync feature up to a GitHub repo, and then have figtok
run in a GH action. Then on each update you get the updated CSS files outputted to a particular location. This would enable you to update styles in Figma, push changes from the UI, and have the updates automatically propagate to your live site/app/whatever.
This project is in a super-WIP state currently and probably won't work for you. It's only really guaranteed to work with Figma Tokens Pro, and if you use the "multiple files" option that splits your tokens into separate json files in directories instead of one huge json file. (see TODOs below.)
{base-size} * {font-scale}
not {base-size}*{font-scale}
or {base-size}* {font-scale}
etc.)```bash yarn add -D figtok
yarn global add figtok ```
You can also install this package via Cargo
cargo install figtok
```bash
figtok --dir ./tokens --out ./build ```
This package is deployed both to Cargo and NPM so that users can install the CLI easily in JS projects alongside their design tokens if they prefer. To deploy, you can use the commands in the Makefile
- currently this uses rust-to-npm to automatically print out the boilerplate files for JS environments.
Once you're ready to deploy:
- Make sure you have Cargo Bump installed
- Run cargo bump [patch | minor | major]
- Run make build
to compile for prod, and update the necessary JS files to use the latest version.
- Run make deploy
to push out to Cargo and NPM simultaneously (You may need to enter 2FA for NPM.)
var(--whatever)
- or a reference to a part of the theme. This means that all values become static (theme.background === '#fff'
instead of theme.background === "var(--neutral-0)"
) main.rs
and Lib lib.rs
@import
to include the relevant sets in one file.)@import
all of the individual sets per-theme with the option to include all, namespaced by a class name on :root
bash
rust-to-npm build
rust-to-npm deploy