Press "Enter" to skip to content

Structuring html blocks in blade

As a developer, we often run into situation where we cannot find a closing div. In this case even IDE does not help because it will simply assume there is one last div is missing at the end of html structure.

The best way to prevent the mess up in html div are to use components in laravel.

For example, you have this piece of code

Now, imagine if you have missed the closing tag of second div.

Your IDE will tell you that there needs to a closing div tag after your last div. So, we will put it. But that is not supposed to happen. If luck runs out, it will create a chain of mess which will force your to rearrange your div structure from start, piece by piece.

So, to prevent these sort of mess, we can use blade components.

Save it as input.blade.php . Now use this component this way,

Any error configuration will  throw out an error straight away. You can play around on how make it more smoother.

 

Everything is awesome.

Be First to Comment

    Leave a Reply

    Your email address will not be published.