Skip to content

Commit

Permalink
Merge pull request #9 from codemix/dynamic-includes
Browse files Browse the repository at this point in the history
add support for dynamic (computed) includes
  • Loading branch information
samsonradu committed Jul 28, 2014
2 parents f4a85de + 449f1a7 commit b4def10
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b4def10

Please sign in to comment.