You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
A feature.
What is the current behavior?
A exports.locals object is automatically created, resolving human-friendly class names to their generated names.
What is the expected behavior?
It would be nice to be able to intercept and modify the code that is exported using a hook. This would be done using a exportsHook option in the loader and would run the exported code by this function, if it exists, before the loader finishes.
If this is a feature request, what is motivation or use case for changing the behavior?
This would allow people to create custom behaviour for how their styles are imported into their components. Although the use cases are endless, I have a very specific one in mind.
Instead of importing an object with the class names, I want to import a small function that would be aware of the classes available and do some smart management/concatenation with them, accepting as first argument the component to be rendered as well as a list of conditions/classes to be added to it. Ultimately, this is what I want to achieve:
The implications in terms of file size and performance would be negligible, as we're talking about an if statement that checks for the function and calls it if it exists. It wouldn't introduce any breaking changes either.
I'm more than happy to put together a PR and tests for this, just wanted to check whether this is something that you'd like to see happening.
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
A feature.
What is the current behavior?
A
exports.locals
object is automatically created, resolving human-friendly class names to their generated names.What is the expected behavior?
It would be nice to be able to intercept and modify the code that is exported using a hook. This would be done using a
exportsHook
option in the loader and would run the exported code by this function, if it exists, before the loader finishes.If this is a feature request, what is motivation or use case for changing the behavior?
This would allow people to create custom behaviour for how their styles are imported into their components. Although the use cases are endless, I have a very specific one in mind.
Instead of importing an object with the class names, I want to import a small function that would be aware of the classes available and do some smart management/concatenation with them, accepting as first argument the component to be rendered as well as a list of conditions/classes to be added to it. Ultimately, this is what I want to achieve:
The implications in terms of file size and performance would be negligible, as we're talking about an if statement that checks for the function and calls it if it exists. It wouldn't introduce any breaking changes either.
I'm more than happy to put together a PR and tests for this, just wanted to check whether this is something that you'd like to see happening.
Thanks in advance!
The text was updated successfully, but these errors were encountered: