-
Notifications
You must be signed in to change notification settings - Fork 194
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
More control over CSS modules dashed-idents naming #315
Comments
I think the custom transform API I'm working on (#363) could help with this! |
The custom transform API is now released. See https://lightningcss.dev/transforms.html. Hopefully you're able to solve your case with that. If it becomes a common enough request we could add more options to Lightning CSS core, but at least now it is possible. |
The custom transform API is great! I created a transform that wraps any class selectors in I guess I could do a similar transform to add I'd still be blocked by #102 from relying on the built-in CSS modules transforms though. I wonder if it could be generalised or exposed somehow, so that we could transform a node's name into something like |
@devongovett Should this issue be reopened, as the current custom transforms API does not allow changing the definitions of the custom properties to be global? |
In our design system we have a public API consisting of class names and CSS variables. We also have some CSS variables that we consider implementation details that we don't want to leak to consumers, and thus want to hash/rename.
Right now if we set a pattern like
[hash]_[local]
this will apply to both class names and CSS variables.For example
I want the
--_color-blue
variable to be mangled with a hash. There are other more practical use cases like controlling values withdata-
attributes without presenting the CSS variable as a public API.We currently have a csstree transform mangling variables prefixed with
_
, which achieves what we want but is not a very obvious syntax.Doing the following and mangling all non-global variables would be a better syntax, but with lightningcss it would currently also add hashes to the class name unless we specify
:global
on every single selector.The text was updated successfully, but these errors were encountered: