Skip to content

Conversation

@chioio
Copy link

@chioio chioio commented Jul 8, 2025

Description

Summary

  • Add support for custom twMergeFn in createTV function
  • Allow users to pass pre-configured twMerge instances
  • Runtime config takes precedence over createTV config

Changes

  • Added twMergeFn option to TWMConfig type
  • Updated cn function to use custom merge function when provided
  • Enhanced createTV to properly handle custom merge functions
  • Added comprehensive tests for all scenarios

Test plan

  • All existing tests pass
  • New tests cover custom twMergeFn functionality
  • Type checking passes
  • Linting passes

Additional context


What is the purpose of this pull request?

Support custom tailwind merge function for createTV

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Follow the Style Guide.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

@chioio
Copy link
Author

chioio commented Jul 10, 2025

This is my scenario:

import { twMerge } from '@weapp-tailwindcss/merge'
import { createTV } from 'tailwind-variants'

export const tv = createTV({
  twMergeFn: twMerge,
})

weapp need escape symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant