eta-dev / eta

Embedded JS template engine for Node, Deno, and the browser. Lighweight, fast, and pluggable. Written in TypeScript

Home Page:https://eta.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pass entire it context under partial

multivoltage opened this issue · comments

description request

I need to get myVar from it context in a templated called by parent with <%~ include("./footer", { it: allEntireIt }) %>
and use inside footer <%~ it.myVar %>

proposal solution

Pass entire all contex down the three

alternative

Maybe this is not a feature and there is already a method for this goal

@nebrelbug
I think solution is

<%~ include("./footer", { ...it }) %>

Maybe I can open a PR for improve docs? Probably for you and people using template engine is "easy" to imaginate spread operator, but for me I spent 1 entire day :)

@multivoltage glad you got it working! Another possibility is

<%~ include("./footer", it) %>

I'd appreciate a PR!