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

Nested object support in the js plugin #73

Closed
mike-engel opened this issue Aug 16, 2023 · 1 comment
Closed

Nested object support in the js plugin #73

mike-engel opened this issue Aug 16, 2023 · 1 comment

Comments

@mike-engel
Copy link
Contributor

For some cases, having a proper nested object for js tokens would be preferrable over dot-notation strings:

// fine, but not optimal sometimes
{
  'colors.gray': '#123456',
  'colors.black': '#000000',
  'colors.white': '#FFFFFF',
}

// would be better in some instances
{
  colors: {
    gray: '#123456',
    black: '#000000',
    white: '#FFFFFF',
  }
}

Would you be open to a config option to output a nested object rather than dot-notation string accessors?

@drwpow
Copy link
Collaborator

drwpow commented Aug 16, 2023

Oh yes! That’s a great idea. While I still feel that a flat array is a better default, I do agree that there are times when you just want to export a nested JS object like you proposed

And the nice part is, TypeScript-wise, you don’t even need to type it! It’ll just figure itself out 😄

But anyway, yes, would be open to adding this

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