Skip to content

Instantly share code, notes, and snippets.

@elliotf
Last active December 16, 2015 11:59
Show Gist options
  • Save elliotf/5431787 to your computer and use it in GitHub Desktop.
Save elliotf/5431787 to your computer and use it in GitHub Desktop.
Jade templates cannot be reused for individual items and lists
node_modules
var express = require('express')
, jade = require('jade')
;
var item = {
title: "A thing"
};
var list = [item];
jade.renderFile('item.jade', item, function(err, html){
console.log("ITEM: ", html);
var context = {
things: list
};
jade.renderFile('list.jade', context, function(err, html){
if (err) console.log("LIST ERR: ", err);
console.log("LIST: ", html);
});
});
ol
for thing in things
// I would like to be able to do:
//include item
// but I would need to render item with "thing" as its context
h4= thing.title
{
"dependencies": {
"jade": "~0.29.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment