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

Automatically apply a variant to all utilities used in certain files #3560

Closed
4 tasks done
RebeccaStevens opened this issue Feb 14, 2024 · 1 comment
Closed
4 tasks done

Comments

@RebeccaStevens
Copy link
Contributor

Clear and concise description of the problem

I'd like to be able to transform the following

<button class="bg-red p-4 b-1 b-solid b-blue">Foo</button>

into

<button class="bar:bg-red bar:p-4 bar:b-1 bar:b-solid bar:b-blue">Foo</button>

by specifying that the bar variant should be applied to all utilities in a certain collection of files (e.g. all files in the components directory).

This will allow for doing things such as changing the layer all these utilities are generated on; helping to prevent CSS specificity issues.

Suggested solution

I believe this can be done with a transformer - though I'm entirely sure.

Alternative

No response

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the README.md of using the package.
  • Already used the Interactive Docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@Simon-He95
Copy link
Contributor

I think you can completely use the unocss parser and then use your own plug-in to handle it.

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