Handlebars one line helper syntax conventions

Viewed 447

I do work a lot with one line helpers in my current project. This is possibly an indication of "there is something wrong with your data structure". Regardless, I found myself often confusing the instances of one line helpers with actual data variables.

I have seen that some people have a convention that all custom helpers begin with an uppercase letter. For my project, I put a $ in front of them, this seems to be more noticeable. And that works fine so far, and is helping a bit. Although constructions with if/else helpers such as

{#$helper}...{/$helper}

look silly. As a workaround for this, I thought I would use a $ only for one line helpers, but this approach has drawbacks as one should precisely control helpers.

If anyone has been in a similar situation and has arrived at a better solution, please share.

0 Answers
Related