Skip to content

Commit

Permalink
Fixes marko-js#202 - Pass along options to compiler when loading a te…
Browse files Browse the repository at this point in the history
…mplate
  • Loading branch information
patrick-steele-idem committed Jan 12, 2016
1 parent 9dabb89 commit d8f8929
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions runtime/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ function loadSource(templatePath, compiledSrc) {
return templateModule.exports;
}

function loadFile(templatePath) {
function loadFile(templatePath, options) {
templatePath = nodePath.resolve(cwd, templatePath);
var targetDir = nodePath.dirname(templatePath);

var targetFile = templatePath + '.js';
var compiler = markoCompiler.createCompiler(templatePath);
var compiler = markoCompiler.createCompiler(templatePath, options);
var isUpToDate = compiler.checkUpToDate(targetFile);
if (isUpToDate) {
return require(targetFile);
Expand Down Expand Up @@ -89,15 +89,15 @@ module.exports = function load(templatePath, templateSrc, options) {
// Don't write the compiled template to disk. Instead, load it
// directly from the compiled source using the internals of the
// Node.js module loading system.
var compiler = markoCompiler.createCompiler(templatePath);
var compiler = markoCompiler.createCompiler(templatePath, options);
if (templateSrc === undefined) {
templateSrc = fs.readFileSync(templatePath, fsReadOptions);
}

var compiledSrc = compiler.compile(templateSrc);
return loadSource(templatePath, compiledSrc);
} else {
return loadFile(templatePath);
return loadFile(templatePath, options);
}
};

Expand Down

0 comments on commit d8f8929

Please sign in to comment.