blade-formatter
blade-formatter copied to clipboard
Setting that would ignore formatting on specific tags, i.e. <svg> ?
Formatting things like a <svg> tag can take up several lines of code and is not really that necessary.
Now this plugin does an excellent job formatting it, but it adds tons of new lines to my code.
This is just a feature request to allow a setting that ignores certain tags if not too much trouble?
I know I can use {{-- blade-formatter-disable-next-line --}} , but this would be easier if possible 😉
Thanks guys.
Thanks for requesting the feature @yabdab
it adds tons of new lines to my code.
From my understand, you are talking about like below code with --wrap-attributes option is set to force-expand-multiline?
$ cat test.blade.php
<svg height="130" width="500">
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:rgb(255,255,0);stop-opacity:1" />
<stop offset="100%" style="stop-color:rgb(255,0,0);stop-opacity:1" />
</linearGradient>
</defs>
<ellipse cx="100" cy="70" rx="85" ry="55" fill="url(#grad1)" />
<text fill="#ffffff" font-size="45" font-family="Verdana" x="50" y="86">SVG</text>
Sorry, your browser does not support inline SVG.
</svg>
$ ./bin/blade-formatter test.blade.php --wrap-attributes force-expand-multiline
<svg
height="130"
width="500"
>
<defs>
<linearGradient
id="grad1"
x1="0%"
y1="0%"
x2="100%"
y2="0%"
>
<stop
offset="0%"
style="stop-color:rgb(255,255,0);stop-opacity:1"
/>
<stop
offset="100%"
style="stop-color:rgb(255,0,0);stop-opacity:1"
/>
</linearGradient>
</defs>
<ellipse
cx="100"
cy="70"
rx="85"
ry="55"
fill="url(#grad1)"
/>
<text
fill="#ffffff"
font-size="45"
font-family="Verdana"
x="50"
y="86"
>SVG</text>
Sorry, your browser does not support inline SVG.
</svg>
I agree that it would be a lot of lines.
My personal recommendation is if you are concerned about lines of code, split them into Anonymous Components would be a good solution.
However, I understand that there are some use cases where it is more convenient to ignore certain tags, so I'll give some thought to what we should do.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days