tokenPathToCssVarName

Theme
stable

Resolve a token path array to an origam CSS variable name (WITHOUT the leading `--`). Applies the Origam naming convention: triple-tiret for property, double-tiret for state/BEM-child, and `__` for BEM child elements.

API

Signature

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

path
requis
ReadonlyArray<string>
Ordered path segments from the token JSON. The first segment is always the block name (e.g. `"btn"`, `"color"`). Subsequent segments encode state, BEM child, or property parts.
isComponent
requis
boolean
True for component tokens (`tokens/component/*.json`), false for primitive/semantic tokens. Selects which naming branch is applied.

API

Valeur de retour

La valeur retournée par cet util.

The CSS variable name without `--`, e.g. `"origam-btn--primary---background-color"` or `"origam-color__neutral---500"`.

Usage

Exemples

Extraits de code prêts à coller.

Encode component token paths with state and BEM child

typescript