Feature request: transforms = transforms + transformGroups
funyapu opened this issue · 4 comments
Use case
If user want a transform addition to transformGroup
, he needs to list all of the transforms in preset as well.
And if he set both, no warning but just ignoring transformGroup
.
Current
{ transforms: ['attribute/color'], transformGroup: 'css' }
=> ['attribute/color'],
Expect
{ transforms: ['attribute/color'], transformGroup: 'css' }
=> ['attribute/cti',' attribute/color', 'color/css', 'size/rem', 'name/cti/kebab' ],
It took me a while to notice this behavior....
Thanks for bringing this up, I agree there should be a warning if a user attempts to include a transform
and a transformGroup
to notify them that the behavior may be different than expected.
Additionally, we could add information about how this behaves to the documentation.
Hi @funyapu thanks for your comment.
I believe that are correct in you assessment here and we had not considered the case in which someone tries to use both transforms and transformGroups. I believe that what happens is that the system either prioritizes transforms over transformGroups or uses whichever is the "Last In" of the two.
As for using both... unfortunately transforms are not commutative; the order of operation matters. We might do one of the following:
- Combine into a single configuration property that allows for both transforms and transformGroups and process them in the order provided.
- Add more specific documentation about not using them both at the same time and output a warning when they are
Lastly, while it might be a bit tedious, you can always register your own transform group. You can use a mixture both of custom transforms (registered via registerTransform) and existing within the library. This allows you to explicitly specify how you want to combine your transforms.
Hopefully that last platform helps you get what you need for now.
Added to the v4 branch