blade-formatter icon indicating copy to clipboard operation
blade-formatter copied to clipboard

[Feature]: Expand Multiline only when wrap line length is exceeded?

Open seb-jones opened this issue 1 year ago • 3 comments

Description

Hi there,

Using --wrap-attributes=force-expand-multiline works nicely for long tags with many attributes, such as the following output:

<my-awesome-blade-component
    first-attribute="Foo"
    second-attribute="Bar"
    third-attribute="Baz"
></my-awesome-blade-component>

However, for very small tags, such as meta tags, it might be nicer to keep them like this:

    <meta name="fragment" content="!">

Rather than this, which is what this option would currently do:

    <meta
        name="fragment"
        content="!"
    >

When you have a layout blade file with lots of meta, link etc. tags you quickly end up with a very long file if this is done for every tag!

Suggested Solution

An additional value for the --wrap-attributes, perhaps just called expand-multiline, that only does the expansion if the --wrap-line-length is actually exceeded.

Alternatives

No response

Additional Context

No response

seb-jones avatar Jul 02 '23 17:07 seb-jones