Skip to content

Commit

Permalink
Added dynamic js example
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 11, 2010
1 parent 6587e7f commit a0bc793
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/dynamicscript.jade
@@ -0,0 +1,5 @@
html
head
title Dynamic Inline JavaScript
:javascript
| var users = #{JSON.stringify(users)}
20 changes: 20 additions & 0 deletions examples/dynamicscript.js
@@ -0,0 +1,20 @@

/**
* Module dependencies.
*/

var jade = require('./../lib/jade');

var options = {
locals: {
users: {
tj: { age: 23, email: 'tj@vision-media.ca', isA: 'human' },
tobi: { age: 1, email: 'tobi@is-amazing.com', isA: 'ferret' }
}
}
};

jade.renderFile(__dirname + '/dynamicscript.jade', options, function(err, html){
if (err) throw err;
console.log(html);
});

0 comments on commit a0bc793

Please sign in to comment.