Skip to content

Fix arbitrary variables of font-family and font-weight groups being merged incorrectly #588

@dcastil

Description

@dcastil

How does one resolve the conflict between font-family and font-weight with arbitrary values?

EX:
twMerge('font-(family-name:--custom-family) font-(--custom-weight)')
-> returns: font-(--custom-weight) expected: font-(family-name:--custom-family) font-(--custom-weight)
twMerge('font-(--custom-weight) font-(family-name:--custom-family)')
-> returns font-(family-name:--custom-family) expected: font-(--custom-weight) font-(family-name:--custom-family)

Originally posted by @bguggie in #584

Just checked and you're right, this is a bug, I'll fix it.

This one is not easy to resolve due to how tailwind-merge works internally and it will take some time for me to find a way to fix it. As a workaround you can use the important modifier on one of the classes to make sure the both stay in the output, e.g. font-(family-name:--custom-family) font-(--custom-weight)!.

#584 (reply in thread)

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingIs breaking changebugSomething isn't workingcontext-v3Related to tailwind-merge v3

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions