From 646244753d2f7474935b9475d89b4fba3b0a9a8a Mon Sep 17 00:00:00 2001 From: eikaramba Date: Thu, 29 Dec 2016 04:02:19 +0100 Subject: [PATCH 1/3] Change Marko Implementation to support v4 Marko changed its implementation and thus "The render callback will no longer receive a string in Marko v4. Use `renderToString(data, callback)` instead" See https://github.com/marko-js/marko/pull/450. This change is compatible with the current stable public version. --- lib/consolidate.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 8a06431..7efb6f8 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -1452,7 +1452,7 @@ exports.marko = function(path, options, fn){ try { var tmpl = cache(options) || cache(options, engine.load(path, options)); - tmpl.render(options, fn) + tmpl.renderToString(options, fn) } catch (err) { fn(err); } @@ -1470,7 +1470,7 @@ exports.marko.render = function(str, options, fn) { try { var tmpl = cache(options) || cache(options, engine.load('string.marko', str, options)); - tmpl.render(options, fn) + tmpl.renderToString(options, fn) } catch (err) { fn(err); } From 6a298b45e57ff6b95168059427eacbb7bc7e2665 Mon Sep 17 00:00:00 2001 From: eikaramba Date: Fri, 30 Dec 2016 01:38:54 +0100 Subject: [PATCH 2/3] Use filename as a unique identifier Otherwise subsequent calls will always only return the template, that was loaded first. This is because Marco is using cached Templates by default. --- lib/consolidate.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/consolidate.js b/lib/consolidate.js index 7efb6f8..9e9c2dd 100644 --- a/lib/consolidate.js +++ b/lib/consolidate.js @@ -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); From 084ccaa8205c81a31d2e803b89ecc8bdbc8ceae9 Mon Sep 17 00:00:00 2001 From: eikaramba Date: Sun, 8 Jan 2017 13:47:51 +0100 Subject: [PATCH 3/3] update bracket-template to fix build errors --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 97989a9..4e325d5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "atpl": ">=0.7.6", "babel-core": "^6.7.6", "babel-preset-react": "^6.5.0", - "bracket-template": "^1.0.3", + "bracket-template": "^1.1.4", "dot": "^1.0.1", "dust": "^0.3.0", "dustjs-helpers": "^1.1.1",