Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: JSONC support #698

Closed
TrevorBurnham opened this issue Sep 20, 2021 · 2 comments
Closed

Feature request: JSONC support #698

TrevorBurnham opened this issue Sep 20, 2021 · 2 comments

Comments

@TrevorBurnham
Copy link
Contributor

Currently, style-dictionary supports JSON5 for token files (PR: #165). JSON5 is used in the transitive-transforms example "so that it can be marked up with comments for reference." YAML is also supported, and has its own example project.

I think it's great that these alternative formats are supported, but vanilla JSON still seems to be the most popular format for storing tokens. As a developer, it's the format I'm most comfortable with. But, I'd really like to be able to add comments to my token files. There's a format that would make that possible: JSONC, aka "JSON with Comments".

Using JSONC, this would be possible:

{
  "color": {
    "font": {
      // Colors used for text on a light background
      "base": { "value": "#111111" },
      "secondary": { "value": "#333333" },
      "tertiary": { "value": "#666666" },

      // Colors used for text on a dark background
      "inverse": {
        "base": { "value": "#ffffff" }
      }
    }
  }
}

The JSONC format is very popular. There's even built-in syntax support in VS Code:

JSON with Comments syntax selection

In short, I think JSONC would be a perfect format for tokens. 😄

@chazzmoney
Copy link
Collaborator

Hi @TrevorBurnham

Thanks for the suggestion - we would love to support JSONC if there is a straightforward way of doing so. Do you think you could submit a PR for us?

To get you started, this is where the configuration is actually loaded; we currently just piggyback off of require().

Looking forward to merging in a JSONC configuration PR in the future!

@TrevorBurnham
Copy link
Contributor Author

@chazzmoney Thanks for the encouragement! I've opened a PR: #732

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants