Answer the question
In order to leave comments, you need to log in
How to build a Gulp task to precompile a Handlebars template from a .json file?
There is an array shop.json
{
"items" : [{
"item1" : {
"name" : "OXXXY",
"price" : 2000,
"available" : true,
"size" : true,
"img" : "/img/2.jpg"
},
"item2" : {
"name" : "OXXXY",
"price" : 2000,
"available" : true,
"size" : true,
"img" : "/img/2.jpg"
}
}]
}
<script id="entry-template" type="text/x-handlebars-template">
{{#each items}}
<div class="item grid" style="background-image: url('{{img}}')">
<a id="0001" href="#" class="item_content item_modal">
<p class="text_dec dec1 decB">{{name}}</p>
<p class="text_dec">{{price}}</p>
</a>
</div>
{{/each}}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question