mix jetons.namespace (jetons v0.2.0)

Copy Markdown View Source

Hoists the --keys token groups under --group across every *.tokens.json under DIR and rewrites the {ref}s pointing at them, so the tokens emit --group-* CSS properties (hue.300 -> color.hue.300 -> --color-hue-300).

Idempotent; only rewrites files it changes. See Jetons.Namespace.

Usage

mix jetons.namespace path/to/tokens --group color --keys accent,hue,hue-t,utility
mix jetons.namespace path/to/tokens --group color --keys accent,hue,hue-t,utility --check

Options

  • --group - parent group to nest under (required)
  • --keys - comma-separated top-level keys to move and re-reference (required)
  • --unnest - reverse: lift --keys out of --group and strip the prefix
  • --check - report changes without writing; exits non-zero if any are needed

Example

Given palette.tokens.json (--group color --keys hue):

{ "hue": { "300": { "$value": "#3b82f6" } } }

the task rewrites it in place to:

{ "color": { "hue": { "300": { "$value": "#3b82f6" } } } }

and prints palette.tokens.json: nested 1 group(s), rewrote refs.