green-labs / res_tailwindcss

ReScript PPX which validates the tailwindcss class names
MIT License
28 stars 5 forks source link

Class sorting #29

Closed srnnkls closed 1 year ago

srnnkls commented 1 year ago

Are there plans to implement automatic sorting of classes, based on the convention followed by tw’s own prettier plugin?

mununki commented 1 year ago

I've never heard of tailwind + prettier sorting a given class name, but that's not what ppx does. PPX doesn't transform the source code, which means it does change the internal representation when the source code is processed inside the compiler. So I think prettier can be used to parse expressions that are %twc("c1 c2 ...") if you set it up to do so well, independent of ppx.

srnnkls commented 1 year ago

Of course, a ppx can only influence the target. So it would be theoretically possible to produce sorted output on the js side, right?

Thank you and sorry for the noise!

mununki commented 1 year ago

It's technically correct that PPX affects JS output. But unfortunately, that's a job better suited to a linter or prettier, so it's better to keep it out of the way of compilation speed.