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

support classnames #93

Open
AdrienLemaire opened this issue Sep 28, 2020 · 2 comments
Open

support classnames #93

AdrienLemaire opened this issue Sep 28, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@AdrienLemaire
Copy link

Is your feature request related to a problem? Please describe.

I'm using tailwindcss-classnames by @muhammadsammy in my typescript project to have typed classes. But unfortunately, I do not get auto-sorting of classname arguments.

Describe the solution you'd like
Currently, we can get sorting with

return (
- <div className="bg-red-500 container mx-auto text-white" />
+ <div className="container mx-auto text-white bg-red-500" />
);

I'd like the following snippet to also get sorted the same way.

import {classnames as cn} from 'tailwindcss-classnames';

- const divCn = cn("bg-red-500", "container", "mx-auto", "text-white");
+ const divCn = cn("container", "mx-auto", "text-white", "bg-red-500");

return (
  <div className={divCn} />
);

Note that it should also work with multilines:

const divCn = cn(
-  "bg-red-500", 
  "container", 
  "mx-auto",
-  "text-white"
+  "text-white",
+  "bg-red-500", 
);

Describe alternatives you've considered
Current, I'm using vim fu to sort alphabetically my classes, which is suboptimal. I'd really like to enjoy headwind's sort order.

@heybourn heybourn added the enhancement New feature or request label Oct 6, 2020
@heybourn
Copy link
Owner

heybourn commented Oct 6, 2020

This isn't something I plan on adding support for at this stage but I'm always open to PR's 👍

@tylersayshi
Copy link
Contributor

Was this fixed with #109? I noticed it was mentioned as getting resolved, but I cannot get the sorting to work with and sort of classname function still. Demo of sort working with normal className string, but not the function call:

headwind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants