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

Can't parse tokens if there is only one @tokens comment in a file #131

Open
ilyamore88 opened this issue Oct 16, 2022 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ilyamore88
Copy link

File for example:

.hds-root-colors-dark {
  /**
  * @tokens Colors Dark
  * @presenter Color
  */
  --color-bg-primary: #2f3341;
  --color-bg-secondary: #252732;
  --color-bg-tertiary: #1b1d26;
  --color-accent-brand: #4979e4;
  --color-bg-main-transparent: rgba(36, 39, 50, 0);
  --color-bg-placeholder: #505b74;
}

Output in design-tokens.source.json:

{"cssTokens":{"categories":[{"name":"Colors Dark","presenter":"Color","range":{"from":{"column":3,"line":2},"to":{"column":3,"line":2}},"source":"/Users/ilyamore88/Documents/codex-team/hawk.garage.react/src/commons/themes/root-colors-dark.css","tokens":[]},{"name":"Colors Light", ...

How did I fix it:

I've added /* @tokens End */ at the end of my file:

.hds-root-colors-dark {
  /**
  * @tokens Colors Dark
  * @presenter Color
  */
  --color-bg-primary: #2f3341;
  --color-bg-secondary: #252732;
  --color-bg-tertiary: #1b1d26;
  --color-accent-brand: #4979e4;
  --color-bg-main-transparent: rgba(36, 39, 50, 0);
  --color-bg-placeholder: #505b74;
  /* @tokens End */
}

Output in design-tokens.source.json:

{"cssTokens":{"categories":[{"name":"Colors Dark","presenter":"Color","range":{"from":{"column":3,"line":2},"to":{"column":34,"line":11}},"source":"/Users/ilyamore88/Documents/codex-team/hawk.garage.react/src/commons/themes/root-colors-dark.css","tokens":[{"isAlias":false,"name":"--color-bg-primary","presenter":"Color","rawValue":"#2f3341","sourceType":"CSS","value":"#2f3341"},{"isAlias":false,"name":"--color-bg-secondary","presenter":"Color","rawValue":"#252732","sourceType":"CSS","value":"#252732"},{"isAlias":false,"name":"--color-bg-tertiary","presenter":"Color","rawValue":"#1b1d26","sourceType":"CSS","value":"#1b1d26"},{"isAlias":false,"name":"--color-accent-brand","presenter":"Color","rawValue":"#4979e4","sourceType":"CSS","value":"#4979e4"},{"isAlias":false,"name":"--color-bg-main-transparent","presenter":"Color","rawValue":"rgba(36, 39, 50, 0)","sourceType":"CSS","value":"rgba(36, 39, 50, 0)"},{"isAlias":false,"name":"--color-bg-placeholder","presenter":"Color","rawValue":"#505b74","sourceType":"CSS","value":"#505b74"}]},{"name":"Colors Light", ...

The version is 2.7.1

@Sqrrl
Copy link
Collaborator

Sqrrl commented Apr 13, 2023

Thanks for reporting. In some cases detecting the end of the block fails. I'll try to fix your case in a future release.

@Sqrrl Sqrrl added the bug Something isn't working label Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants