design-tokens-cli icon indicating copy to clipboard operation
design-tokens-cli copied to clipboard

Configurability of prefixes

Open o-t-w opened this issue 3 years ago • 0 comments

It would be nice if it was possible to control the prefixes that get added to the output variables. I am grouping my tokens primarily because I don't want to add a $type to every individual property so instead do it at the group level:

{   "colors": {
    "$description": "Color palette",
    "$type": "color",
    "error": { "$value": "red" },
    "success": { "$value": "green" },
    "warning": { "$value": "yellow" } 
},
    "sizes": {
        "$type": "dimension",
        "radius": { "$value": "3px" },
        "tiny": { "$value": "8px" },
        "small": { "$value": "16px" },
        "medium": { "$value": "24px" },
        "large": { "$value": "32px" },
        "xlarge": { "$value": "40px" }
    }
}

However, I do not want the output variables to have any prefixes. I prefer to use a terse variable name in my code e.g. var(--small) over var(--sizes-small). Most of the names are descriptive enough by themselves e.g. var(--red) is obviously a color. I don't see much point in the extra verbiage.

o-t-w avatar Oct 05 '22 21:10 o-t-w