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
Our Handlebars syntax uses a mixture of elements with and without spaces separating the handlebars and the prefix. E.g.
{{_ vs. {{ _
{{# vs. {{ #
{{> vs. {{ >
While this does not make a difference to the Handlebars compiler, it has the following shortcomings for humans:
it is inconsistent
including spaces marginally reduces readability
it has caused trouble when doing a project wide search/replace when cleaning up i18n strings
Proposal
Reformat all, or most, Handlebars code to remove spaces between the handlebars ({{) and 'prefix' (_, #, and >).
Rationale
A quick search of our code found the following counts:
139 results for {{>
22 results for {{ >
Similarly, we tend to keep the # character next to the {{ in template block helpers:
107 results for {{#
41 results for {{ #
We should prefer the first version, keeping > and # close to the {{ for these reasons:
both cases are more common in our code, currently
the > and # characters are a bit noisy, since they are not English words (i.e. they are more to help the computer than the developer who is reading the sourcecode)
combining the {{> and {{# into single string, without space, makes them simpler (both to read and type)
Both the handlebars ({{) and prefixes (_, #, and >) are used primarily to help the computer (parser) to do its job.
Combining handlebars and prefixes makes it, slightly, easier for the human to read, and still accomplishes the same. I.e. {{_, {{> and {{# are easy for us to read and distinguish (without spaces), while the parser can still do its job just fine.
Quick summary
I am proposing we remove the space infix because:
handlebars spaces are unnecessary
handlebars spaces do not significantly increase readability (although spaces increase readability elsewhere in our code)
i.e. template helpers without spaces between the prefix are easy to read, since the last character is easy to distinguish
most template helpers in our code do not separate the handlebars ({{) from the prefix (_, >, #)
The text was updated successfully, but these errors were encountered:
Our Handlebars syntax uses a mixture of elements with and without spaces separating the handlebars and the prefix. E.g.
{{_
vs.{{ _
{{#
vs.{{ #
{{>
vs.{{ >
While this does not make a difference to the Handlebars compiler, it has the following shortcomings for humans:
Proposal
Reformat all, or most, Handlebars code to remove spaces between the handlebars (
{{
) and 'prefix' (_
,#
, and>
).Rationale
A quick search of our code found the following counts:
{{>
{{ >
Similarly, we tend to keep the
#
character next to the{{
in template block helpers:{{#
{{ #
We should prefer the first version, keeping
>
and#
close to the{{
for these reasons:>
and#
characters are a bit noisy, since they are not English words (i.e. they are more to help the computer than the developer who is reading the sourcecode){{>
and{{#
into single string, without space, makes them simpler (both to read and type)Both the handlebars (
{{
) and prefixes (_
,#
, and>
) are used primarily to help the computer (parser) to do its job.Combining handlebars and prefixes makes it, slightly, easier for the human to read, and still accomplishes the same. I.e.
{{_
,{{>
and{{#
are easy for us to read and distinguish (without spaces), while the parser can still do its job just fine.Quick summary
I am proposing we remove the space infix because:
{{
) from the prefix (_
,>
,#
)The text was updated successfully, but these errors were encountered: