How to use custom option form grunt task in loops

45 Views Asked by At

I am using grunt-assemble, in grunt task I add custom option of language by following below documentation

assemble docs and below is the image of my grunt task grunt task

{{language}}
{{#withSort pages "data.navSortOrder"}}
{{langugae}}
{{#is data.showInNav true}}
<li{{#is ../../page.dest this.dest}} class="active"{{/is}}>

{{language}}


{{/is}}
{{/withSort}}

In above code language outside the withsort block is outputting the expected result but in withsort block language option isn't outputting anything

1

There are 1 best solutions below

1
On

When using block helpers like withSort, handlebars changes the depth of the data. To access the previous depth (where language is), you can use the .. syntax. If you know language will always be at the root of the context, then you can use the @root keyword:

{{language}}
{{#withSort pages "data.navSortOrder"}}
{{../language}}
{{@root.language}}
{{#is data.showInNav true}}
<li{{#is ../../page.dest this.dest}} class="active"{{/is}}>

{{language}}


{{/is}}
{{/withSort}}

Also... when updating your example, I noticed that the second "language" was spelled as "langugae".