Handlebars ignore compile
Pour ignorer la compilation d'un morceau de code d'Handlebars :
{{{{raw-helper}}}}
{{bar}}
{{{{/raw-helper}}}}
Et il faut ajouter le helper :
Handlebars.registerHelper('raw-helper', function(options) {
return options.fn();
});
Très pratique pour faire une rendu d'une page, pour ensuite faire un second rendu d'un attr par exemple :
<div data-tpl="{{{{raw-helper}}}}{{file}}{{{{/raw-helper}}}}">{{path}}</div>
Après un premier rendu on obtiens ça :
<div data-tpl="{{file}}">Mon Chemin</div>
Mon 30 Nov 2015 12:17:22 PM CET - permalink -
-
https://github.com/wycats/handlebars-site/blob/f57f7257aeccc3269f85d5e9bede6f2b5121978c/src/pages/block_helpers.haml