vendredi 9 décembre 2016

Handlebars: Pass helper generated value to partial

I created a Handlebars helper for our own i18n library which looks a bit like this:

Handlebars.registerHelper('i18n', (type, key, optionalValue) => optionalValue ?
  i18n[type](key, optionalValue.hash) :
  i18n[type](key)
);

I want to use this helper te generate a value to pass on to a partial. Something like this:

}}

As expected this generated a syntax error.

Any ideas how I could accomplish this behaviour?




Aucun commentaire:

Enregistrer un commentaire