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

Class sorting is not working when arbitrary value is used #183

Open
snax4a opened this issue Feb 7, 2022 · 4 comments
Open

Class sorting is not working when arbitrary value is used #183

snax4a opened this issue Feb 7, 2022 · 4 comments

Comments

@snax4a
Copy link

snax4a commented Feb 7, 2022

Hi,

I noticed that plugin is not sorting classes of the element if there is at least one arbitrary value.

This will not be sorted because of w-[200px] class used

<div className="px-5 w-[200px] py-6 justify-center flex flex-col"></div>

This works:

<div className="px-5 py-6 justify-center flex flex-col"></div>
@leoriviera
Copy link

I've just come across this issue too. Any way to fix it or work around it?

@ruridge
Copy link

ruridge commented Aug 19, 2022

Still no word on how to resolve this?

@sina-salahshour
Copy link

sina-salahshour commented Sep 13, 2023

I think the problem is caused because the extension sorts the classes based on an array of string(so it doesn't match dynamic tailwind classes), i think i would be better to use regex instead and include the arbitrary values alos.

headwind/package.json

Lines 57 to 66 in ae5d26f

"headwind.defaultSortOrder": {
"type": "array",
"default": [
"container",
"decoration-slice",
"decoration-clone",
"box-border",
"box-content",
"block",
"inline-block",

headwind/src/utils.ts

Lines 37 to 41 in ae5d26f

classArray = sortClassArray(
classArray,
sortOrderClone,
options.shouldPrependCustomClasses
);

it would also be much less code. currently there are 5216 lines only for specifying tailwind class names (with the dynamic ones missing)

@az-nextsec
Copy link

This is still an issue unfortunately :(

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

5 participants