Skip to content
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

feat(twmerge): inject function like tailwind merge possible #25

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions packages/core/src/tailwind-buddy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { cleanString } from "./utils/strings";

// Utility functions
const mergeClasses = (classes: string[]): string => {
const uniquifyClasses = (classes: string[]): string => {
return [...new Set(classes.filter(Boolean))].join(" ");
};

Expand All @@ -29,7 +29,10 @@ const flattenVariant = <S extends Slots>(
};

// Main function
export const setupCompose = <Sc extends string>(screens: Sc[]) => {
export const setupCompose = <Sc extends string>(
screens: Sc[],
mergeClasses: (str: string) => string = (str) => str
) => {
return <
V extends Variants<S>,
CV extends CompoundVariant<V, S>,
Expand Down Expand Up @@ -200,7 +203,7 @@ export const setupCompose = <Sc extends string>(screens: Sc[]) => {
.forEach((cls) => classSet.add(cls));
}

const result = mergeClasses(Array.from(classSet));
const result = mergeClasses(uniquifyClasses(Array.from(classSet)));
variantCache.set(cacheKey, result);
return result;
};
Expand Down
259 changes: 0 additions & 259 deletions packages/documentation/.vitepress/cache/deps/@theme_index.js

This file was deleted.

This file was deleted.

58 changes: 0 additions & 58 deletions packages/documentation/.vitepress/cache/deps/_metadata.json

This file was deleted.

Loading
Loading