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

DEFAULT theme keys being lowercased #266

Closed
davidkelley opened this issue Jun 6, 2023 · 5 comments
Closed

DEFAULT theme keys being lowercased #266

davidkelley opened this issue Jun 6, 2023 · 5 comments

Comments

@davidkelley
Copy link

Hi,

Thanks for a great library. I'm in the middle of implementing this for our theme, but have noticed that the DEFAULT keyword is being lowercased inside the output. Tailwind needs this to be uppercased, so that we can make use of class names such as bg-orange for example. Are you able to help?

tailwindlabs/tailwindcss.com#1114
https://v2.tailwindcss.com/docs/upgrading-to-v2#update-default-theme-keys-to-default

@nado1001
Copy link
Owner

Hi, @davidkelley
Thank you for raising the great issue!
The "DEFAULT" theme key is now supported in version 1.3.2.
Please update your package version and check it.
We are also testing this on the example, so you can check it out in conjunction with the example if you like.

@davidkelley
Copy link
Author

Thanks very much @nado1001. Really useful library, great work!

@3CordGuy
Copy link

3CordGuy commented Sep 19, 2023

Sorry to resurrect a closed issue, but I don't see this working on the latest version when outputting individual theme files. Seems like the original keys are used (not transformed keys).

For example if I do a transform like this:

StyleDictionary.registerTransform({
  type: 'name',
  name: 'upperDefault',
  matcher: token => token.name.includes('default'),
  transformer: prop => {
    let u = prop.path
      .map(part => {
        if (part.includes('default')) {
          return part.toUpperCase();
        }
        return part;
      })
      .join('.');

    return u;
  },

The output still used the path and not the new name transform which has "DEFAULT" in the new name.

@nado1001
Copy link
Owner

@3CordGuy
Sorry for the delay in noticing the issue.
Can you show us the whole source code in your repository, codesandbox, etc., so that we can get a better understanding of the issue here?

@3CordGuy
Copy link

I ended up rolling with another solution. Thanks for responding, though. I appreciate you putting this library out there.

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

3 participants