Closed defunctzombie closed 10 years ago
+1
+1 to {{ }}
or #{}
:+1:
{{}}
all the way. {}
is too difficult to read within templates imo
I'm fine with {}
, but +1 for {{}}
over #{}
, we generate lots of reactive templates with jade.
I'd recommend against putting blocks of code that have curly brackets in the templates, that makes it tough to read. But simple expressions would be nice.
In terms of maximum optimization, the {}
cuts out some extra characters. But it also (seems to) mean you couldn't allow for having raw JSON in the templates down the road if that was desired (but also not recommended because it seems like an anti-pattern, it seems the interpolated expressions should at least adhere to conventions that minimize the work the parser has to do).
Flex's MXML used {}
and that was easy to read and never caused any limitations.
The {{}}
is widely adopted, but it's also verbose.
@defunctzombie I have never run into the case you're describing, of having to escape something in an expression. What are some cases you're thinking of?
I don't really have a preference, more used to {{}}
but feel like {}
would be nice to use as well because it's simpler.
I believe if you try to use the following as a reactive template it will fail:
<div>{name}</div>
<code>function() { }</code>
Obviously a trivial example but the idea is that { }
is syntactically more common then {{ }}
Ah, makes sense!
{{ }}
+1 as it's easier to understand.
+1 for double-stash.
+1
+1
+1
Work on this is being done in the next branch. Install and test with that if you want {{ }}
I think {{ }} is better because it allows for blocks of code { } in the template body without having to escape them. Less things conflict with {{ }} versus { } (which is why most other template engines use the double {{ }}. It would be a breaking change, unless made an option (which we can easily do now).
There was a PR earlier about this and I would like to revisit the idea.