Skip to content

Instantly share code, notes, and snippets.

@hakobera
Created August 29, 2011 12:39
Show Gist options
  • Save hakobera/1178303 to your computer and use it in GitHub Desktop.
Save hakobera/1178303 to your computer and use it in GitHub Desktop.
Using jQuery Template in node.js
var jsdom = require('jsdom');
jsdom.env({
html: "<html><body></body></html>",
scripts: [
'http://code.jquery.com/jquery-1.6.2.min.js',
'http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js'
]
}, function (err, window) {
var $ = window.jQuery;
var t = $.tmpl('<div>${message}</div>', { message: 'Hello World' });
console.log(t.text());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment