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

theme() doesn't generate tokens until someone explicitly defines them #86

Open
AndreyYolkin opened this issue Dec 8, 2024 · 0 comments

Comments

@AndreyYolkin
Copy link

AndreyYolkin commented Dec 8, 2024

Version

0.14.1

Reproduction repo (check uno.config and src/App.vue)

GH: https://github.com/AndreyYolkin/uno-nested-theme-keys
CSB: https://codesandbox.io/p/devbox/github/AndreyYolkin/uno-nested-theme-keys

Description

We want to utilize unocss as colors token manager and apply colors via theme() directive.

However, there is an issue with generating the token for color which is only used in theme and never more.

What we expect

image

What we got

image

Additional moment

This token begins to work if this color is mentioned inside atomic class. For example, after I gave bg-button-primary to a random element (or even mention in the comment) --un-preset-theme-colors-button-primary variable becomes generated

Little UPD: nesting doesn't matter, as occurs. Second button has color because the class 'bg-primary' was present

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

1 participant