Wrong blade indentation #33017
-
Hey all. Wanted to speak about something that always bugs me about using blade. Let's say I have this code: <div class="app">
@include('partials.navbar')
</div> And this file contains: <header class="app-header app-header-dark">
<div class="top-bar">something</div>
</header> I would expect the output of <div class="app">
<header class="app-header app-header-dark">
<div class="top-bar">something</div>
</header>
</div> But instead I see <div class="app">
<header class="app-header app-header-dark">
<div class="top-bar">something</div>
</header>
</div> As you can see the indentation is wrong here and I am trying to figure out if it's possible to fix. Of course in the end it does not matter as the html works absolutely fine, but I like to have clean html and it seems impossible. Anyone have any thoughts on this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
That's just how the compiler works. It would be an insane amount of work to make sure everything was always properly indented. You could use an indenting library afterwards maybe. I've used https://github.com/gajus/dindent fairly recently in a project. Not ideal but there's not much better out there. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I guess it is. Just checked with plain php files and actually it's just how php compiler works, so blade has not much to do with it really. TIL. I guess when I worked with plain php & html last time I didn't really care about these things, so I never realised :D Thanks for the suggestion I will look into that library. |
Beta Was this translation helpful? Give feedback.
That's just how the compiler works. It would be an insane amount of work to make sure everything was always properly indented. You could use an indenting library afterwards maybe. I've used https://github.com/gajus/dindent fairly recently in a project. Not ideal but there's not much better out there.