Limitations

The differences that are real, stated plainly.

prettier-plugin-tailwindcss flattens these templates

prettier-plugin-tailwindcss sorts class names inside any template literal it finds in a className, regardless of the tag. On a multi-line template that means the newlines are collapsed and the comments are moved to the front, away from the classes they annotated. tailwindPreserveWhitespace keeps the shape of the lines but still reorders tokens across them.

There is no setting that makes the two work together. Leave the plugin out and sort with twl/sort-classes instead, which keeps every class inside its comment group, or use // prettier-ignore on the attribute.

Invalid escapes

A template containing an escape with no cooked value, such as cn`\unicode` , is rejected with a compiler diagnostic.

On this page