Skip to content

Commit 468ef23

Browse files
authored
Merge pull request #200 from StratusFearMe21/reorder_processing
Process slots before processing subtree
2 parents 1c31939 + 476bad0 commit 468ef23

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,6 @@ let processCounter = 0;
166166
* @return {Object} PostHTML tree
167167
*/
168168
function processTree(options) {
169-
const filledSlots = {};
170-
171169
return (tree, messages) => {
172170
log(`Processing tree number ${processCounter}..`, 'processTree');
173171

@@ -176,6 +174,8 @@ function processTree(options) {
176174
}
177175

178176
match.call(tree, options.matcher, currentNode => {
177+
const filledSlots = {};
178+
179179
log(`Match found for tag "${currentNode.tag}"..`, 'processTree');
180180

181181
if (!currentNode.attrs) {
@@ -229,14 +229,14 @@ function processTree(options) {
229229
return currentNode.content || nextNode.content;
230230
});
231231

232+
// Process <slot> tags
233+
processSlotContent(nextNode, filledSlots, options);
234+
232235
nextNode = processTree(options)(nextNode, messages);
233236

234237
// Process <fill> tags
235238
processFillContent(nextNode, filledSlots, options);
236239

237-
// Process <slot> tags
238-
processSlotContent(nextNode, filledSlots, options);
239-
240240
// Remove component tag and replace content with <yield>
241241
currentNode.tag = false;
242242
currentNode.content = content;

0 commit comments

Comments
 (0)