Skip to content

Commit

Permalink
[just] [test] [dist] Add just engine plugin and associated test for a…
Browse files Browse the repository at this point in the history
…sync render(), Add just template engine to devDependencies
  • Loading branch information
eschmitt committed Aug 17, 2012
1 parent 9d35e12 commit fb44bc6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
21 changes: 21 additions & 0 deletions lib/engines/just/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Just Support
*/

exports.attach = function (options) {
var Just = require ('just'),
options = options || {};
this.just = {
render: function (view, data, cb) {
var engine;
options.root = {};
options.root.page = view.template;
engine = new Just(options);
try {
engine.render('page', data, cb);
} catch (err) {
cb(err);
}
}
};
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"hogan.js": "*",
"jazz": "*",
"jqtpl": "*",
"just": "*",
"mustache": "*",
"qejs": "*",
"underscore": "*",
Expand Down
8 changes: 8 additions & 0 deletions test/viewful-engines-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ vows.describe('viewful-engines-test').addBatch({
}),
'and calling View.render(user)': helpers.renderSync(user, "<p>tobi</p>"),
'and calling View.render(user, cb)': helpers.render(user, "<p>tobi</p>")
},

'a new viewful.View({ input: "just" })': {
topic: new viewful.View({
template: "<p><%= user.name %></p>",
input: "just"
}),
'and calling View.render(user, cb)': helpers.render(user, "<p>tobi</p>")
}

}
Expand Down

0 comments on commit fb44bc6

Please sign in to comment.