merge
A re-export of tailwind-merge augmented with
clsx for conditional classes with object-syntax support.
See this github comment for details.
tailwind-merge exports twMerge that overrides conflicting
classes from right to left.
Example
<script>
import {merge} from '@eirikk/sveltekit-stuff';
$: classes = merge(
'p-2',
{ 'm-5': true },
['hover:bg-pink-400'],
true && 'stroke-indigo-500',
undefined, // untruthy values
null, // are simply ignored
false
);
</script>
<div class={classes} />
Demo
output:
'p-1'