Permalink
Browse files

better mixins example

  • Loading branch information...
1 parent 3f41c2f commit 62b3ed6900086299e3f4a5c96544cdb10c1600c9 @tj tj committed Jul 13, 2011
View
@@ -1,5 +1,6 @@
-include dialog-mixins
+include mixins/dialog
+include mixins/profile
.one
mixin dialog
@@ -8,4 +9,8 @@ include dialog-mixins
mixin dialog-title('Whoop')
.three
- mixin dialog-title-desc('Whoop', 'Just a mixin')
+ mixin dialog-title-desc('Whoop', 'Just a mixin')
+
+
+#profile
+ mixin profile(user)
View
@@ -5,7 +5,14 @@
var jade = require('./../lib/jade');
-jade.renderFile(__dirname + '/mixins.jade', function(err, html){
+var user = {
+ name: 'tj'
+ , pets: ['tobi', 'loki', 'jane', 'manny']
+};
+
+var options = { locals: { user: user }};
+
+jade.renderFile(__dirname + '/mixins.jade', options, function(err, html){
if (err) throw err;
console.log(html);
});
File renamed without changes.
@@ -0,0 +1,10 @@
+
+mixin pets(pets)
+ ul.pets
+ - each pet in pets
+ li= pet
+
+mixin profile(user)
+ .user
+ h2= user.name
+ mixin pets(user.pets)

0 comments on commit 62b3ed6

Please sign in to comment.