shufo / prettier-plugin-blade

Format your blade template using Prettier
https://www.npmjs.com/package/@shufo/prettier-plugin-blade
MIT License
318 stars 8 forks source link

[Formatting Bug]: if else endif removes the trailing space inline and breaks the blade #204

Closed tonypartridge closed 6 months ago

tonypartridge commented 1 year ago

Version

1.5.6

Template before formatting

class="@if(amount > 0) py-2 @else py-4 px-4 @endif relative"

Template after formatting

class="@if($amount > 0) py-2 @else py-4 px-4 @endifrelative"

Expected Behaviour

class="@if($amount > 0) py-2 @else py-4 px-4 @endif relative"

Relevant log output

No response

shufo commented 1 year ago

@tonypartridge I could not reproduce in my environment. Can you paste minimum reproduceable settings and template? Thank you.

aryala7 commented 1 year ago

i also have this issue. this is my config file { "useLaravelPint": true, "classStrings": { "enabled": false }, "pintCacheEnabled": false, "customIfs": [], "formatDirectivePhpParameters": false, "formatDirectiveJsonParameters": false, "formatInsideEcho": false, "spacesAfterDirective": 1, "spacesAfterControlDirective": 3, "phpOptions": { "phpVersion": "8.2" } } before formatting: @if((isset($banner) && $banner->model_type === 0) || old('model_type') === 0) selected @endif value=""

after formatting: @if((isset($banner) && $banner->model_type === 0) || old('model_type') === 0) selected @endifvalue=""

github-actions[bot] commented 10 months ago

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

shufo commented 10 months ago

@aryala7 Seems this config is not for this package.

{
  "useLaravelPint": true,
  "classStrings": {
    "enabled": false
  },
  "pintCacheEnabled": false,
  "customIfs": [],
  "formatDirectivePhpParameters": false,
  "formatDirectiveJsonParameters": false,
  "formatInsideEcho": false,
  "spacesAfterDirective": 1,
  "spacesAfterControlDirective": 3,
  "phpOptions": {
    "phpVersion": "8.2"
  }
}

Please paste entire template (remove secret value if needed) and config cause I could not reproduce it.

github-actions[bot] commented 8 months ago

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

github-actions[bot] commented 6 months ago

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