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

Alphabetical HTML attribute sorting with Blade directives issue

Open Random72IsTaken opened this issue 3 years ago • 0 comments

Code

<input @unless ($hasMask())
           {{ $applyStateBindingModifiers('wire:model') }}="{{ $getStatePath() }}"
           type="{{ $getType() }}"
       @else
           x-data="textInputFormComponent({
               {{ $hasMask() ? "getMaskOptionsUsing: (IMask) => ({$getJsonMaskConfiguration()})," : null }}
               state: $wire.{{
                   $isLazy() ?
                       'entangle(\'' . $getStatePath() . '\').defer' :
                       $applyStateBindingModifiers('entangle(\'' . $getStatePath() . '\')')
               }},
           })"
           type="text"
           wire:ignore
           @if ($isLazy()) x-on:blur="$wire.$refresh" @endif
           {{ $getExtraAlpineAttributeBag() }}
       @endunless />

Formatted

<input @endunless
   {{ $getExtraAlpineAttributeBag() }}
   @unless($hasMask()) {{ $applyStateBindingModifiers('wire:model') }}="{{ $getStatePath() }}"
           type="{{ $getType() }}"
       @else
           x-data="textInputFormComponent({
               {{ $hasMask() ? "getMaskOptionsUsing: (IMask) => ({$getJsonMaskConfiguration()})," : null }}
               state: $wire.{{ $isLazy()
                   ? 'entangle(\'' . $getStatePath() . '\').defer'
                   : $applyStateBindingModifiers('entangle(\'' . $getStatePath() . '\')') }},
           })"
           type="text"
           wire:ignore
           @if ($isLazy()) x-on:blur="$wire.$refresh" @endif />

Note

It seems that there are more issues than just the HTML sorting with the provided code sample, and that are alignment (wrapAttributes) related...

If you could, please check out the Blade views in Filament packages, which aim to exploit the tall-stack and Laravel Blade to the core! -Infinite testing samples, pretty much! 🙂

Random72IsTaken avatar Aug 10 '22 17:08 Random72IsTaken