Skip to content

Formatter: Tailwind sort ERB classes #907

@xdmx

Description

@xdmx

Input:

<%= form.submit class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>

Output:

<%= form.submit class: "w-full sm:w-auto rounded-md px-3.5 py-2.5 bg-blue-600 hover:bg-blue-500 text-white inline-block font-medium cursor-pointer" %>

Expected:

<%= form.submit class: "inline-block w-full cursor-pointer rounded-md bg-blue-600 px-3.5 py-2.5 font-medium text-white hover:bg-blue-500 sm:w-auto" %>

Playground:

Playground (I don't see an option to enable the Tailwind sorter on it)

Additional context:

I've enabled the Tailwind sorter in a project and loving it, but I've noticed that it's not currently sorting classes that are defined in Ruby/ERB

I've also tried to wrap them in class_names(...). The same is also happening with complex logic (like class: ["rounded-md px-3.5", { "px-3.5 py-2.5": admin, "px-4.5 py-3.5": !admin }]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions