5f664dd78b
The idea is that the environment wraps up the mutable stuff in Handlebars (like the helpers) and that you could theoretically create a new one at any time and pass it in to Handlebars.template. Every test makes a new environment and uses it in template compilation.
16 lines
456 B
JavaScript
16 lines
456 B
JavaScript
require('./common');
|
|
|
|
global.Handlebars = require('../../dist/handlebars.runtime');
|
|
|
|
var compiler = require('../../lib/handlebars');
|
|
|
|
global.CompilerContext = {
|
|
compile: function(template, options, env) {
|
|
var templateSpec = compiler.precompile(template, options);
|
|
return Handlebars.template(eval('(' + templateSpec + ')'), env);
|
|
},
|
|
compileWithPartial: function(template, options, env) {
|
|
return compiler.compile(template, options);
|
|
}
|
|
};
|