Skip to content

Custom classes are sorted incorrectly #181

@francoism90

Description

@francoism90

What version of prettier-plugin-tailwindcss are you using?

v0.3.0

What version of Tailwind CSS are you using?

v3.0.22

What version of Node.js are you using?

20.4.0-r0

What package manager are you using?

npm

What operating system are you using?

Linux (Docker)

Reproduction URL

saadeghi/daisyui#2124 (reply in thread)

I can provide a public Reproduction URL, however the maintainer of DaisyUI @saadeghi confirms the same issue.
If it's still required, I'm happy to provide one. :)

Describe your issue

The problem is the invalid sorting of DaisyUI (or any other framework I tried) custom classes.

Result:

<div class="card-compact card rounded-none p-3"/>
<div class="menu-compact menu m-1"/>
<button type="button" class="btn-secondary btn h-6 w-6" />

Expected:

<div class="card card-compact rounded-none p-3"/>
<div class="menu menu-compact m-1"/>
<button type="button" class="btn btn-secondary h-6 w-6" />

I cannot find any configuration options to solve this. I've tried multiple packages, including https://github.com/francoismassart/eslint-plugin-tailwindcss, also different options, but it all results incorrect ordering of classes.

I do understand this package is used to sort Tailwind classes, however it would be nice if it could understand sub classes, e.g. menu-* after menu. Or sort Tailwind classes, and leave unknown classes in the provided order. :)

Please let me know if you need more info.

Thanks.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions