Global Handlebars.compile uses its env

The basic strategy is that there will be a global Handlebars object for
the browser build, and that object will have a `compile` on it which
uses its environment in the compiler.

It will also be possible to glue things together manually by using the
AMD build and passing the environment to `compile` directly. Some of
these details are TBD.
This commit is contained in:
Yehuda Katz
2013-07-26 18:08:32 +00:00
parent d33408fcbd
commit 6f580c9beb
+5 -1
View File
@@ -20,7 +20,11 @@ var create = function() {
hb.SafeString = SafeString;
hb.Exception = Exception;
hb.Utils = { extend: extend, escapeExpression: escapeExpression, isEmpty: isEmpty };
hb.compile = compile;
hb.compile = function(input, options) {
options = options || {};
options.env = options.env || env;
return compile(input, options);
};
hb.precompile = precompile;
hb.template = template;
hb.createFrame = createFrame;