diff --git a/src/index.js b/src/index.js index 31d75d3..ab0e89d 100644 --- a/src/index.js +++ b/src/index.js @@ -166,8 +166,6 @@ let processCounter = 0; * @return {Object} PostHTML tree */ function processTree(options) { - const filledSlots = {}; - return (tree, messages) => { log(`Processing tree number ${processCounter}..`, 'processTree'); @@ -176,6 +174,8 @@ function processTree(options) { } match.call(tree, options.matcher, currentNode => { + const filledSlots = {}; + log(`Match found for tag "${currentNode.tag}"..`, 'processTree'); if (!currentNode.attrs) { @@ -229,14 +229,14 @@ function processTree(options) { return currentNode.content || nextNode.content; }); + // Process tags + processSlotContent(nextNode, filledSlots, options); + nextNode = processTree(options)(nextNode, messages); // Process tags processFillContent(nextNode, filledSlots, options); - // Process tags - processSlotContent(nextNode, filledSlots, options); - // Remove component tag and replace content with currentNode.tag = false; currentNode.content = content;