How to use parameter in assemble partial

122 Views Asked by At

How to use parameter in handlebar partial I am using grunt-assemble and cant find anything in docs For Example I will create a partial name heading and use it in my template

<h1 class="tac  mt-80 underline">
{{heading}}
</h1>

<body>
    {{> heading "Test"}}
</body>
1

There are 1 best solutions below

0
On

unfortunately, thats not possible with grunt-assemble out of the box. Their recommended way is to use the parseJSON helper for that:

{{#parseJSON '{"heading": "TEST"}'}} {{> heading }} {{/parseJSON}}

But you should take a look at the current implementation of assemble, which includes a updated version of Handlebars (which provides your wished functionality). It seems like they moved away from Grunt in favor of compatibility with Gulp.