machty / emblem.js

Emblem.js - Ember-friendly, indented syntax alternative for Handlebars.js
http://emblemjs.com
MIT License
1.04k stars 81 forks source link

One-way default bindings #225

Open theazureshadow opened 9 years ago

theazureshadow commented 9 years ago

Ember is moving to one-way bindings by default, if you use the new component syntax (which I don't think has landed yet). How can Emblem handle this transition, since its syntax doesn't need to change substantially?

bantic commented 9 years ago

@theazureshadow Emblem will need to print out the mut keyword when it is requested. This is something that we need to figure out still, but I expect something like the following would be the syntax Emblem would adopt:

%my-video src={mut movie.url} paused=controller.isPaused

would be printed like this:

<my-video src={{mut movie.url}} paused={{controller.isPaused}}></my-video>

Emblem 0.5.0+ doesn't yet target HTMLBars syntax (it still uses bind-attr, for instance) yet, so that would be another change. There will eventually be an Emblem release that prints out without using the bind-attr for those on HTMLBars.

theazureshadow commented 9 years ago

That's a nice approach. So like HTMLBars, Emblem would use a slightly different syntax (possibly a % prefix) to invoke the new defaults. That would make sense, and provide those of us with a large set of templates a way to migrate them gradually.

bnetter commented 8 years ago

Hey guys, is this working somehow with Emblem? Thanks.

machty commented 8 years ago

@bnetter we're blocked on angle bracket syntax landing in Ember. Til then, emblem bindings will behave as they do in Ember Handlebars/Glimmer when using curly {{x-component foo=bar}} syntax: foo will be two-way bound to bar.