Last active
December 16, 2015 11:59
-
-
Save elliotf/5431787 to your computer and use it in GitHub Desktop.
Jade templates cannot be reused for individual items and lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
h4= title |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"jade": "~0.29.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment