When using Tailwind CSS, sometimes the class attribute can become very long. Unfortunately, being a single attribute, this plugin does not wrap it. For example:
It would be nice to auto-wrap the class, splitting on whitespace and indenting its contents. For example, using appropriate printWidth and wrapAttributes options, it should format the class like this:
But this is labor-intensive, error-prone, and foregoes any possible auto-sorting of Tailwind classes between separate strings in the array, even if #221 was implemented to allow sorting within each single string.
Description
When using Tailwind CSS, sometimes the class attribute can become very long. Unfortunately, being a single attribute, this plugin does not wrap it. For example:
Suggested Solution
It would be nice to auto-wrap the class, splitting on whitespace and indenting its contents. For example, using appropriate printWidth and wrapAttributes options, it should format the class like this:
Which is arguably easier to read and to maintain.
Alternatives
An alternative is to use an utility such as
@class
and manually splitting the class into shorter lines:But this is labor-intensive, error-prone, and foregoes any possible auto-sorting of Tailwind classes between separate strings in the array, even if #221 was implemented to allow sorting within each single string.
Additional Context
No response