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

Fix: Support css variables in translation calculations #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

loganwishartcraig
Copy link

Summary

We use css variable references in our custom tailwind theme instead of standard hardcoded values. Currently, this results in mangled values when using this library:

.data-\[side\=bottom\]\:slide-in-from-top-2[data-side="bottom"] {
    --tw-enter-translate-y: -var(--spacing-2);
}

This PR addresses the issue my moving to calc(...) where relevant to allow usage of css variables. Given there are no recommendations from tailwind I'm aware of warning users not to use css tokens for spacing theme values, I've just adjusted tailwindcss-animate slightly to resolve.

Happy to discuss questions/concerns or close if this feels too niche a usecse.

@loganwishartcraig
Copy link
Author

loganwishartcraig commented Oct 10, 2024

If backwards compatibility is a concern for whatever reason, we may also consider only wrapping in calc if the value looks like a css variable reference (e.g. matches a RegExp).

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