From 449f1a7bc7bee44c79112f23bf4a546a69ee784d Mon Sep 17 00:00:00 2001 From: Charles Pick Date: Mon, 28 Jul 2014 14:42:24 +0100 Subject: [PATCH] add support for dynamic (computed) includes --- lib/compiler.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/compiler.js b/lib/compiler.js index c3013e5..6f8cfa4 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -471,12 +471,20 @@ Trees.IncludeStatementIterateExpressionIndexNoContent = astify(function IncludeS }); CustomTypes.IncludeStatement = function (node) { - var options = { - src: { - type: "Literal", + var src; + if (typeof node.attributes.src === 'string') { + src = { + type: 'Literal', value: node.attributes.src || '', raw: JSON.stringify(node.attributes.src || '') - }, + }; + } + else if (typeof node.attributes.src === 'object') { + src = node.attributes.src.expression; + } + + var options = { + src: src, body: { type: 'BlockStatement', body: node.body