summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2011-07-30 15:24:14 -0500
committerkpdecker <kpdecker@gmail.com>2011-07-30 15:24:14 -0500
commit600a669d12356008beb98490dd93dbde95518083 (patch)
tree4c20dab8c6dd71424d0be5c1bacbee7d9ae6253c /lib/handlebars/compiler/compiler.js
parent5aa12b5e09cfa62f956bafd9b4f62bab07f712dc (diff)
downloadhandlebars.js-600a669d12356008beb98490dd93dbde95518083.zip
handlebars.js-600a669d12356008beb98490dd93dbde95518083.tar.gz
handlebars.js-600a669d12356008beb98490dd93dbde95518083.tar.bz2
Expose Handlebars.precompile method from the compiler.
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index c9fb7f8..ce9bea5 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -673,5 +673,11 @@ Handlebars.JavaScriptCompiler = function() {};
})(Handlebars.Compiler, Handlebars.JavaScriptCompiler);
+Handlebars.precompile = function(string, options) {
+ var ast = Handlebars.parse(string);
+ var environment = new Handlebars.Compiler().compile(ast, options);
+ return new Handlebars.JavaScriptCompiler().compile(environment, options);
+};
+
// END(BROWSER)