-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
helper names can be paths? #912
Comments
try to use Updated JSFiddle here: http://jsfiddle.net/0e7e2e4L/2/ |
@zordius thanks, that does indeed work. does this work intentionally (i.e. language spec) or is this a side effect of turning the helper name into an object key? thanks again either way. however, if you look at the updated JSFiddle you can see that a partial registered with a slash
however helpers with slashes in their name can only be referenced by wrapping them in IMHO it would be more natural and consistent if a helper name could be invoked in the same manner(s) as a partial name, as they are both just keys on an object. |
The The first parameter in a normal mustache statement is tied to the paths functionality that are used to resolve nested structures and when this is a helper call the same applies. Unfortunately partials are inconsistent with the reset of the language because they are not nested structures rather keys on the object, which is where the disconnect comes from. Unfortunately without a very compelling reason I don't think we can change any of this as that's a pretty big breaking change. |
@kpdecker thanks for the follow up and explanation. my main reason for this change is consistency, which IMHO would make the language easier to learn/use, perhaps even maintain? though obviously you are the expert on that :) i guess this idea is in the same spirit as the request to make sub expressions use |
consider this the helper version of #389: when trying to use "/" in helper names, e.g.
{{string/upper "ahoy!"}}
the helper registers OK but results in aError: Missing helper: 'string/upper'
. here is a simple JSFiddle to demonstrate. note that in the console i am outputting the registered helpers, and the helper with the slash in the namestring/upper
is registered and is a valid object key (same as with partials). also, wrapping the helper name in quotes'string/upper'
or escaping the slash ends up as invalid syntax.use case is the same as with partials: organizing helpers for libraries/easier reuse/etc.
still investigating why this is not working, but please consider this a feature request if it is not a bug.
thanks.
The text was updated successfully, but these errors were encountered: