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

Multiline attributes via brackets aren't working for views #219

Closed snovity closed 7 years ago

snovity commented 9 years ago

The following

 view 'select' [
   content=theContent
   selection=theSelection ]

isn't working. Probably because of the view name 'select' specified before brackets. In contrast

input [
  type='password'
  value=theValue ]

is working.

snovity commented 9 years ago

Just found out that

 view [
  'select' 
   content=theContent
   selection=theSelection ]

works as expected.

snovity commented 9 years ago

Ok, I have to reopen the issue, because although specifying view name inside brackets doesn't trigger compile issues, when compiled it doesn't work.

bantic commented 9 years ago

@snovity thanks. I will try compiling this and see what the handlebars output is. Maybe it is not the expected value.

bantic commented 9 years ago

@snovity I think the issue may be that Emblem is compiling that into a block helper:

 view [
  'select' 
   content=theContent
   selection=theSelection ]

becomes:

 {{#view 'select' content=theContent selection=theSelection}}{{/view}}

Do you think that explains your issue? You can play around with Emblem syntax to see how it will get compiled at this try emblem site

snovity commented 9 years ago

@bantic it seems this is the case, for some reason adding a 'select' triggers a block helper creation and it supplies a blank template to the view. The result is that view renders nothing.

mixonic commented 9 years ago

For views, a block template replaces a template on the view. This should probably not create a block without indented content.

kjhangiani commented 9 years ago

The

input [
  type='password'
  value=theValue ]

syntax does not work for me using ember 1.11, emblem 0.5, and ember-cli-emblem 0.27 (all latest afaik). It also completely chokes if you do

 = input [
        ...
       ]

This syntax is so much cleaner esp when working on a more complicated app with a lot of components (form fields in particular), there's a pull request to fix it as well, is there any chance this will get released soon?