jzzpqg
Last Updated: March 29, 2018
·
13.92K
· wern

Using Laravel's blade with Mustache or Handlebars

Create a new partial for the mustache or handlebars template without using the blade.php extension.:

<script id="friend-list-template" type="text/x-handlebars-template">
<p>
    <ul id="ul-friends">
    {{#each friends}}
        <li>
          <input type="checkbox" data-id="{{ id }}" data-name="{{ name }}">
          {{ name }}
        </li>
    {{/each}}
    </ul>
</p>
</script>

Then include it on the page where you originally included the handlebars / mustache template:

@include('partials.mustache_template') 

8 Responses
Add your response

16022

Thank you!

over 1 year ago ·
16227

Thanks. But how do i use it with .blade.php extension.

over 1 year ago ·
17564

Awesome!!!

over 1 year ago ·
17565

I think the point is to include the partial template without the blade extension from a blade template.

over 1 year ago ·
20788

if you need to use it witin the same main view, you can use @{{ }} to make blade ignore the brackets

over 1 year ago ·
20789

if you need to use it witin the same main view, you can use @{{ }} to make blade ignore the brackets

over 1 year ago ·
28673

Awesome

You Can Try this Laravel Template :Josh - Laravel Admin Template + Front End + CRUD

https://codecanyon.net/item/josh-laravel-admin-template-front-end-crud/8754542?s_rank=1?ref=jyostna

over 1 year ago ·
29782

I don't think there is any need for using Handlebar with Laravel blade, which itself is really easy to setup. You can easily create layout in Laravel by creating include files and then calling it from your view file.

10 months ago ·