summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/runtime.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/runtime.js')
-rw-r--r--lib/handlebars/runtime.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/handlebars/runtime.js b/lib/handlebars/runtime.js
index 991bdfd..74361e8 100644
--- a/lib/handlebars/runtime.js
+++ b/lib/handlebars/runtime.js
@@ -3,17 +3,14 @@ import { COMPILER_REVISION, REVISION_CHANGES } from "./base";
// TODO: Remove this line and break up compilePartial
-export function template(templateSpec, Hbars) {
- // TODO: Make this less global
- Hbars = Hbars || Handlebars;
-
- if (Hbars.compile) {
+export function template(templateSpec, Hbars, compile) {
+ if (compile) {
var invokePartialWrapper = function(partial, name, context, helpers, partials, data) {
var result = invokePartial.apply(this, arguments);
if (result) { return result; }
var options = { helpers: helpers, partials: partials, data: data };
- partials[name] = Hbars.compile(partial, { data: data !== undefined });
+ partials[name] = compile(partial, { data: data !== undefined });
return partials[name](context, options);
};
} else {
@@ -24,6 +21,10 @@ export function template(templateSpec, Hbars) {
};
}
+ if (!Hbars) {
+ throw new Error("YUNO HANDLEBARS");
+ }
+
// Just add water
var container = {
escapeExpression: escapeExpression,
@@ -56,9 +57,6 @@ export function template(templateSpec, Hbars) {
return function(context, options) {
options = options || {};
- Hbars = Hbars || require("handlebars");
-
- // TODO: Why does templateSpec require a reference to the global Handlebars?
var result = templateSpec.call(container, Hbars, context, options.helpers, options.partials, options.data);
var compilerInfo = container.compilerInfo || [],