Skip to content

Tailwind class sorting #436

Open
Open
@steadygaze

Description

@steadygaze

The Tailwind team created a prettier plugin that automatically sorts Tailwind utility classes in a defined order (https://tailwindcss.com/blog/automatic-class-sorting-with-prettier). This has the advantage of not having to think about what order the classes should be in, not having to keep them in the right order manually, and of compressing better if classes always appear in a consistent order.

I was wondering if there was a way to get something like that working in maud, or if it's infeasible. Sadly, doing it the "right" way by extending cargo fmt seems more on the infeasible side because it depends on rust-lang/rustfmt#8, which would let library authors specify how their macros should be formatted.

In something like Askama, the templates look enough like HTML for prettier to work out of the box.

I guess maybe I can create an external program that does this if I care enough, even if that seems hacky.

Another solution I can think of is to reorder classes at compile time in maud, but that is also way too hacky and doesn't have the benefit of sorting them in source.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions