Adding scope.root
This adds a {[scope.root}} that you can use to access the data passed to a stache renderer function. This allows you to avoid scope walking with recursive partials:
const data = new DefineMap({
name: "Earthworm Jim",
child: {
name: "Grey Worm",
child: {
name: "MyDoom"
}
},
exclaim: '!!!'
});
const view = stache("AppTemplate", `
{{<personAndChildren}}
<span>{{name}} {{scope.root.exclaim}}</span>
{{#./child}}
<div>
{{>personAndChildren this}}
</div>
{{/./child}}
{{/personAndChildren}}
{{>personAndChildren this}}
`);