diff options
-rw-r--r-- | dist/handlebars.js | 7 | ||||
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/dist/handlebars.js b/dist/handlebars.js index c91b30d..072ae53 100644 --- a/dist/handlebars.js +++ b/dist/handlebars.js @@ -1380,6 +1380,13 @@ Handlebars.JavaScriptCompiler = function() {}; // Perform a second pass over the output to merge content when possible var source = this.mergeSource(); + if (!this.isChild) { + source = "if (Handlebars.VERSION !== '"+Handlebars.VERSION+"') {\n"+ + "throw 'Template was compiled with "+Handlebars.VERSION+", but runtime is '+Handlebars.VERSION;\n"+ + "}\n"+ + source; + } + if (asObject) { params.push(source); diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 0d21739..b148bbb 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -538,6 +538,13 @@ Handlebars.JavaScriptCompiler = function() {}; // Perform a second pass over the output to merge content when possible var source = this.mergeSource(); + if (!this.isChild) { + source = "if (Handlebars.VERSION !== '"+Handlebars.VERSION+"') {\n"+ + "throw 'Template was compiled with "+Handlebars.VERSION+", but runtime is '+Handlebars.VERSION;\n"+ + "}\n"+ + source; + } + if (asObject) { params.push(source); |