diff options
author | kpdecker <kpdecker@gmail.com> | 2011-07-30 15:24:14 -0500 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2011-07-30 15:24:14 -0500 |
commit | 600a669d12356008beb98490dd93dbde95518083 (patch) | |
tree | 4c20dab8c6dd71424d0be5c1bacbee7d9ae6253c /lib/handlebars/compiler/compiler.js | |
parent | 5aa12b5e09cfa62f956bafd9b4f62bab07f712dc (diff) | |
download | handlebars.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.js | 6 |
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) |