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

Feature request: support for use alongside tailwind-merge and cn()-like patterns #36

Closed
firxworx opened this issue Jun 28, 2024 · 2 comments

Comments

@firxworx
Copy link

I have to start by saying this plugin is INSANELY AWESOME and THANK-YOU so much for investing your time and brilliance into it and releasing it to the world.

I was mucking around with my own approaches to fluidity with tailwind until I stumbled upon fluid.tw and you have taken it to a whole other level and made the tool a dream to use.

Feature Request

I would kindly love for tailwind-merge to be officially supported.

I imagine the community would agree and this would remove a significant barrier for fluid.tw to emerge as one of the hottest tools in the tailwind ecosystem (if you even care about that!)

Support could be in the form of documentation, exporting a tailwind-merge config, or even releasing a plugin for it.

Motivation

tailwind-merge is a hugely popular tool that thoughtfully merges tailwind classes/utilities with 2.2M+ weekly downloads per npm.

One of the most common patterns seen in newer tailwind projects, which as arguably popularized-to-the-moon by the well-known shadcn/ui component "library" is the cn() recipe. It is used to support the creation of readily resusable and customizable components:

import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
  return twMerge(clsx(inputs))
}

Of course a stock configuration of tailwind-merge has no idea what ~ is so any fluid.tw utilities created with the extractor are treated as unrecognized custom classes.

In my own mucking about with custom classes/utilities for fluidity in a tailwind preset I found I pretty much immediately needed to create a customized tailwind-merge and cn() to work with any of the leading tailwind-based component libraries and snippets websites du jour.

References

Discussion question from 2 weeks ago that's related: #29

@barvian
Copy link
Owner

barvian commented Jun 29, 2024

Hey, thanks for the kind words and feedback! I have a tailwind-merge plugin in the works, but it currently doesn't work well with the fluid variants (i.e. ~sm/lg and ~@sm/lg). I submitted a PR to tailwind-merge to hopefully address this, so I'll report back depending on what happens with that 🙂

@barvian
Copy link
Owner

barvian commented Jul 7, 2024

I just pushed an official plugin for tailwind-merge! Check out the docs here. Huge thanks to @dcastil for adding an experimental config option to tailwind-merge 2.4.0 that can accommodate the variants in fluid-tailwind (among other things)!

I'm closing this for now. Feel free to open an issue if you encounter a bug with the plugin 🙂

@barvian barvian closed this as completed Jul 7, 2024
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

No branches or pull requests

2 participants