Re: [community-group] How to define a token that references a local file? (#132)

# Idea # 2: asset type
What if we had a `{ "$type": "asset" }`?

Opting for convention over configuration, assets always exist in a sibling `assets/` directory to the `tokens.json` file.  Additionally, "asset" `$value` will be relative to the `assets/` directory.

```
{package}/
  tokens.json
  assets/
    images/
      icons/
        alert.svg
        bookmark.svg
        ...
    ...
  
```

## Requirements:

1. `$value` MUST NOT begin with `assets/` (this is implied, by convention)

## Example

```json
{
  "assets": {
    "$type": "asset",
    "icons": {
      "alert": { 
        "$value": "images/icons/alert.svg" 
      },
      "bookmark": { 
        "$value": "images/icons/bookmark.svg" 
      }
    }
  }
}
```

## Advantages

1. Defines a shallow convention for co-located assets.
    - file structure within `assets/` is still free-form, to meet the needs of the token package author

## Challenges

1. tbd...


## Questions

1. What if a token package author wants to publish assets using a CDN or other remote location?

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


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

Received on Wednesday, 1 June 2022 16:59:36 UTC