Permalink
Browse files

Added dynamic js example

  • Loading branch information...
tj committed Sep 11, 2010
1 parent 6587e7f commit a0bc7934bca204e3ca3e95fdfd77bdd7f3f0417c
Showing with 25 additions and 0 deletions.
  1. +5 −0 examples/dynamicscript.jade
  2. +20 −0 examples/dynamicscript.js
@@ -0,0 +1,5 @@
+html
+ head
+ title Dynamic Inline JavaScript
+ :javascript
+ | var users = #{JSON.stringify(users)}
View
@@ -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.