You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into two problems with writing my own helpers in ./helpers.
First of all I would like to overwrite the helpers in Broccoli Taco. This line is preventing me from it. I would much rather have the helpers from Broccoli Taco be defaults that I can overwrite if I wanted to. I understand you want to enforce a consistent API and functionality but I believe that when users helpers are not overwriting the "built-in" ones users get confused, like me :)
It is not that big of a deal naming my helpers something else, I just thought I would ask to see if you would be willing to change it.
Secondly, I cannot see that it is documented anywhere that to make any helpers, that return HTML, work properly with Handlebars.SafeString you have to use var Handlebars = require('broccoli-taco/node_modules/handlebars'). Otherwise you end up with your own instance of Handlebars and Handlebars.SafeString that will not match the one used inside Broccoli Taco.
I guess there is an instanceof check or similar inside Handlebars for the SafeString mechanism that makes an instance of Handlebars.SafeString from one Handlebars instance not work with another.
I doubt think could be improved but at least it could be documented better to save other people the time I put in to find the cause. So either use var Handlebars = require('broccoli-taco/node_modules/handlebars') or "triple-stash" ({{{my-helper}}}) for helpers created by users, both will work.
The text was updated successfully, but these errors were encountered:
@michaellopez thanks for the input. I think being able to overwrite the default helpers is ok. I need to look into the Handlebars.SafeString issue more but using var Handlebars = require('broccoli-taco/node_modules/handlebars') seems like an ok short term fix.
I'll try to fix this soon. Pull request are always welcome :)
I ran into two problems with writing my own helpers in
./helpers
.First of all I would like to overwrite the helpers in Broccoli Taco. This line is preventing me from it. I would much rather have the helpers from Broccoli Taco be defaults that I can overwrite if I wanted to. I understand you want to enforce a consistent API and functionality but I believe that when users helpers are not overwriting the "built-in" ones users get confused, like me :)
It is not that big of a deal naming my helpers something else, I just thought I would ask to see if you would be willing to change it.
Secondly, I cannot see that it is documented anywhere that to make any helpers, that return HTML, work properly with
Handlebars.SafeString
you have to usevar Handlebars = require('broccoli-taco/node_modules/handlebars')
. Otherwise you end up with your own instance ofHandlebars
andHandlebars.SafeString
that will not match the one used inside Broccoli Taco.I guess there is an
instanceof
check or similar inside Handlebars for the SafeString mechanism that makes an instance ofHandlebars.SafeString
from one Handlebars instance not work with another.I doubt think could be improved but at least it could be documented better to save other people the time I put in to find the cause. So either use
var Handlebars = require('broccoli-taco/node_modules/handlebars')
or "triple-stash" ({{{my-helper}}}
) for helpers created by users, both will work.The text was updated successfully, but these errors were encountered: