From 6036814777a87f1f7f372aca96cd2a23abe0c705 Mon Sep 17 00:00:00 2001 From: jamon Date: Fri, 16 Dec 2011 17:35:26 -0600 Subject: [PATCH 1/2] Enable "compileFn" like functionality for already-compiled functions. --- lib/dust.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/dust.js b/lib/dust.js index fbead9e..d194eff 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -27,7 +27,11 @@ dust.renderSource = function(source, context, callback) { }; dust.compileFn = function(source, name) { - var tmpl = dust.loadSource(dust.compile(source, name)); + dust.loadFn(dust.compile(source, name)); +}; + +dust.loadFn = function(source) { + var tmpl = dust.loadSource(source); return function(context, callback) { var master = callback ? new Stub(callback) : new Stream(); dust.nextTick(function() { @@ -36,7 +40,6 @@ dust.compileFn = function(source, name) { return master; } }; - dust.load = function(name, chunk, context) { var tmpl = dust.cache[name]; if (tmpl) { From 2f90cf6af15a95b8097e27efe550c55fad772d52 Mon Sep 17 00:00:00 2001 From: jamon Date: Fri, 16 Dec 2011 19:46:48 -0600 Subject: [PATCH 2/2] fixed bugs with my previous pull request --- lib/dust.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dust.js b/lib/dust.js index d194eff..fa3bbc6 100644 --- a/lib/dust.js +++ b/lib/dust.js @@ -27,7 +27,7 @@ dust.renderSource = function(source, context, callback) { }; dust.compileFn = function(source, name) { - dust.loadFn(dust.compile(source, name)); + return dust.loadFn(dust.compile(source, name)); }; dust.loadFn = function(source) { @@ -40,6 +40,7 @@ dust.loadFn = function(source) { return master; } }; + dust.load = function(name, chunk, context) { var tmpl = dust.cache[name]; if (tmpl) {