Closed lukejacksonn closed 3 years ago
Does the second option cover for applying multiple class names? I have an array of strings and I then apply Oceanwind against that. I imagine it would be ow(classes.split(' '))
which isn't bad.
If that's possible, big 👍 then.
I was trying to account for your case whereby you were inputting classes.join(' ')
but perhaps I misunderstood and actually you wanted to input an array without having to join it into a string.
I'm already using an array check to infer a template literal being used, so it might conflict 🤔
@lukejacksonn Yeah, so at the moment I do some tricks to adapt to your API. The ideal would be if it accepted an array of strings out of the box but I can also resolve my data to any form that the API accepts.
From my point of view, ow(['bg-red-500', 'p-4'])
would likely be the ideal as then I wouldn't have to transform the data at all.
Ok, well it turns out I got this all wrong anyway so I'm going to start a fresh. Will be back with a solution shortly.
@lukejacksonn No worries, ping me if you need any help. 👍
The proposed API looks great.
Great! Well I'm happy with the additional flexibility and it wasn't that hard to support all these other variants either. Thanks for creating the issue and reviewing 🙇
Fixes #13
Perviously it was only possible to invoke oceanwind via a tagged template literal with no dynamic parts (or mimicking this with
oceanwind([rules])
). The changes here allows for oceanwind to be invoked in 4 ways:The first improvement is the dynamic parts. The second, being able to pass strings without having to wrap in an array. The last is being able to pass rules or rule sets that are to be applied conditionally (kinda like
clsx
).Still need to update the README to document this change.