Tailwind Resolver - A resolveConfig() alternative for Tailwind v4 #19151
0xstern
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I built a tool that bridges the gap between Tailwind v4's
@theme
variables and JavaScript runtime environments like Chart.js, Canvas, D3, or any library that needs access to your design tokens.For v3 users: This is a
resolveConfig()
alternative for Tailwind v4, since v4's CSS-first approach means the old config-based approach no longer works.Tailwind v4 uses CSS variables (
--color-primary-500
) which work great in CSS but are problematic when you need theme values in JavaScript. You can't use var(--color-primary
) in Chart.js datasets or Canvas contexts.tailwind-resolver
parses your Tailwind files and generates fully-typed TypeScript interfaces plus runtime objects with all your theme values resolved to actual strings.What it does
spacing(4)
function that replicates Tailwind'scalc(var(--spacing) * N)
behaviorExample usage
Features worth mentioning
@import
resolution - handles complex file structures automatically[data-theme='dark'].compact
work correctlyInstallation
GitHub: https://github.com/0xstern/tailwind-resolver
The library is MIT licensed and open to contributions. I'd love to hear feedback from the community, especially if anyone has edge cases or feature requests.
Beta Was this translation helpful? Give feedback.
All reactions