Re: [community-group] Can groups be a property? (#122)

@TravisSpomer wrote :

>I think it's unreasonable to assume that tokens files will only be generated or edited by machines. I wouldn't be surprised at all if token files ended up being generated by hand the majority of the time, especially in the first couple of years while the number of spec-compliant token tools is zero or very few.

https://design-tokens.github.io/community-group/format/#introduction

>While many tools now offer APIs to access design tokens or the ability to export design tokens as a file, these are all tool-specific. The burden is therefore on design system teams to create and maintain their own, bespoke "glue" code or workflows. Furthermore, if teams want to migrate to different tools, they will need to update those integrations.
>
>This specification aims to facilitate better interoperability between tools and thus lower the work design system teams need to do to integrate them by defining a standard file format for expressing design token data.

This specification targets tools which is why it makes sense to me to focus on that.
This will ease adoption and reduce the time persons have to manually interact with token files.

-------------

@TravisSpomer wrote :

> For a flat list to work, the token name would have to include the full group name, not as a separate property.

Correct. Forget about that bit.
So it can actually be simplified further like your example.
No `$group` property is needed to express groups.

But if hierarchy is encoded in the name it would make much more sense to use a `/` as a separator.

Working with paths is well supported in any programming language.

```json
{
    "token uno": {
        "$value": "token value 1"
    },
    "token group/token dos": {
        "$value": "token value 2"
    },
    "token group/nested token group/token tres": {
        "$value": "token value 3"
    }
}
```

-------------

@TravisSpomer wrote :

> It also closes off various potential future features like aliasing or extending groups.

This is perfectly possible without a nested structure :

```json
{
    "token uno": {
        "$value": "token value 1"
    },
    "token group.token dos": {
        "$value": "token value 2"
    },
    "token group.nested token group.token tres": {
        "$value": "token value 3"
    },
    "token group.nested token group b": {
        "$type": "group",
        "$extends": "token group.nested token group"
    },
    "token group.nested token group b.token cuatro": {
        "$value": "token value 4"
    }
}
```

-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/122#issuecomment-1079480527 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 25 March 2022 22:12:31 UTC