Permalink
Browse files

allow options to be passed to both the templateEngine as well as a sp…

…ecific compilation
  • Loading branch information...
1 parent 44dba42 commit 9205320815757cc1aeef0987eea429783804486f Dustin Machi committed Sep 20, 2011
Showing with 11 additions and 1 deletion.
  1. +11 −1 lib/templify.js
View
@@ -2,12 +2,22 @@ var Template = require("./template").Template;
var Rules = require("./rules").Rules;
var when = require("promised-io/promise").when;
var JSON = require("commonjs-utils/json-ext");
+
exports.TemplateEngine=function(options){
var resolver = options.resolver(options.store)
options.resolver = resolver;
options.rules = Rules(options);
var engine = {
- compile: function(id){
+ compile: function(id, extra){
+ var opts = {}
+ for (var i in options){
+ opts[i]=options[i];
+ }
+ if (extra && typeof extra=='object'){
+ for (var i in extra){
+ opts[i]=extra[i]
+ }
+ }
var template = Template(resolver(id), options);
return template;
}

0 comments on commit 9205320

Please sign in to comment.