mix jetons.figma_refs (jetons v0.2.2)

Copy Markdown View Source

Rewrites Figma aliasData literals into Jetons {ref} references.

Figma DTCG exports bake a fully-resolved colour into every $value and keep the alias only under $extensions["com.figma.aliasData"]. This task walks all *.tokens.json files under DIR and replaces each aliased token's $value with a {dot.path} reference (e.g. hue/300 -> {hue.300}), so the CSS transformer can emit cascading var() references and re-resolve tokens across modifier contexts (hue/tone) rather than freezing whatever value was active at export time.

Tokens without aliasData (raw primitives, alpha=0 variants, opacity-derived values) are left untouched. The task is idempotent and only rewrites files it actually changes, so re-exported sources can be re-run safely.

Usage

mix jetons.figma_refs path/to/tokens
mix jetons.figma_refs path/to/tokens --check

Options

  • --check - report what would change without writing; exits non-zero if any conversions are still needed (handy in CI / pre-commit)