Skip to content

Instantly share code, notes, and snippets.

@tkdn
Created February 14, 2015 05:02
Show Gist options
  • Save tkdn/58ddbf1965e341b94152 to your computer and use it in GitHub Desktop.
Save tkdn/58ddbf1965e341b94152 to your computer and use it in GitHub Desktop.
Assemble - Handlebars.js でヘルパーからオブジェクトを参照する ref: http://qiita.com/tkdn/items/499d253c0c71ebdaf56b
module.exports.register = function (Handlebars, options, params) {
'use strict';
Handlebars.registerHelper('foo', function(str) {
return str;
});
};
Handlebars.registerHelper('buz', function(str1, str2) {
var value = "";
for(i=0;this.pages.length>i;i++){...}
return val;
});
{{#each pages}}
<li>{{dest}}</li>
{{/each}}
date: "2015-02-14"
title: "valentine's day"
{{#each pages}}
<li>{{dest}} - {{../title}}</li>
{{/each}}
return new Handlebars.SafeString(str);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment