This is my jade figurine:
section#entry-review-template.template(data-class='entry-review')
table
thead
tr
th='Date'
th='Title'
th
tbody
When I start adding a mustache to it, I feel it starts losing her usual grace, since now she gets very picky about any pores in her face.
{{^entries}}
h1='No Posts'
div='There are no blog posts to review.'
{{/entries}}
However, when I try to add the last piece of mustache, to her body this time, she starts complaining, and she either breaks down and doesn't want to help, or just makes a mess
{{#entries}}
tr
td='{{date}}'
td='{{title}}'
td
a.remove-entry
{{/entries}}
Resulting in something like this:
{{^entries}}
<h1>No Posts</h1><div>There are no blog posts to review.</div>{{/entries}}
{{#entries}}
<table><thead><tr><th>Date</th><th>Title</th><th></th></tr></thead><tbody></tbody></table>{{date}}{{title}}<a class="remove-entry"></a>{{/entries}}
I can't seem to make jade properly output my mustache plain text.
This is a node.js application that uses jade for templating my views on the server-side, I don't pass any models to any of my views (that kind of heavy lifting I leave to the client-side), but I still need to do a bunch of inclue partial
everywhere. And I have lots of jade. And I kind of love jade. I don't want to let go of her.
Now I want to implement very simple mustache templates on the client-side, and I'd like these to be inline in my views.
Of course, I could work around it, and have these in script tags or render them with another view engine (now that I think about it, it doesn't even feel an easy or simple thing to do), but then I would have to write raw html for those, and I kind of wanted to mix the best of both worlds.
{{#must}} {{/ache}}
?I really want jade to wear a mustache. I know its weird, but it'd turn me on.
I just tried using the |, documented here, but even the simplest:
section#entry-review-template.template(data-class='entry-review')
table
thead
tr
th='Date'
th='Title'
th
tbody
| {{#entries}}
| {{/entries}}
ends up outputting:
{{#entries}}
{{/entries}}
<table><thead><tr><th>Date</th><th>Title</th><th></th></tr></thead><tbody></tbody></table><h1></h1>
Solution: jade's HTML comments
// {{#entries}}
tr.entry-row(data-id='{{_id}}')
td='{{date}}'
td='{{title}}'
td
a.edit(title='Edit')='Edit'
a.remove(title='Delete')
// {{/entries}}
works like a charm. you could remove the comments afterwards, but this at least does the trick.