Skip to content

Commit

Permalink
Use filename as a unique identifier
Browse files Browse the repository at this point in the history
Otherwise subsequent calls will always only return the template, that was loaded first. This is because Marco is using cached Templates by default.
  • Loading branch information
eikaramba authored Dec 30, 2016
1 parent 6462447 commit 6a298b4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -1467,9 +1467,10 @@ exports.marko.render = function(str, options, fn) {
return promisify(fn, function (fn) {
var engine = requires.marko || (requires.marko = require('marko'));
options.writeToDisk = !!options.cache;
options.filename = options.filename || 'string.marko';

try {
var tmpl = cache(options) || cache(options, engine.load('string.marko', str, options));
var tmpl = cache(options) || cache(options, engine.load(options.filename, str, options));
tmpl.renderToString(options, fn)
} catch (err) {
fn(err);
Expand Down

0 comments on commit 6a298b4

Please sign in to comment.