On Tue, 10 Mar 2015 16:44:10 GMT, Byron wrote:
I want to find out about adding some support to diet to make using some templates easier.
Plain text without white space removed
I have nested handlebars templates, ex:
.list | {{#each}} p {{name}} | {{/each}}
This results in the {{...}} losing the nested level. Not a big issue but does make debugging templates a little tricky when there are several levels of these.
Maybe:.list + {{#each}} p {{name}} + {{/each}}
I'd solve this similar to Jade and change the code to keep indentation by default. Only for <pre>
tags it would still default to removing indentation. It would then probably also makes sense to control the behavior using the existing >
/<
whitespace control suffixes.
Attributes with an identifier
Handle bars uses nested {{ .. }} in the attribute list
<button class="btn btn-default" {{action 'edit'}}> Edit </button>
Currently my options are:
//- wraps the button in a div < <button class="btn btn-default" {{action 'edit'}}> Edit </button> //- Or a d string |!= `<button class="btn btn-default" {{action 'edit'}}> Edit </button>`
Would be nice to support adding attributes like this
button.btn.btn-default("{{action 'edit'}}") Edit //- Common jade hack, but fails to compile in diet button.btn.btn-default(""="{{action 'edit'}}") Edit
Not sure how hard these would be to support, or if the community would want these.
Sounds like a good addition. Provided that only a string constant is accepted there (starting with either "
or '
), it should also be pretty straight forward to implement.
If you find some time it would be great if you could open a quick ticket on the issue tracker so that this stays on the radar.