locals and multi-nesting
Znarkus opened this issue · 2 comments
Znarkus commented
Is it possible to send a locals variable to an include two levels deep?
I can't find a way to make it work, tried different variants.
A.html
<include src="B.html" locals='{
"location": "Los Angeles"
}'></include>
B.html
<include src="C.html"></include>
C.html
<h1>Hi {{ location }}</h1>
Scrum commented
@Znarkus Hi, not sure if this package does it.
Perhaps this can help you? https://github.com/posthtml/posthtml-expressions#scopes
Let me know if this does not solve your problem and I will make the functionality you need, also welcome PR
Znarkus commented
Thank you for the response. That's interesting, I had missed that one.
Will see if I can work with it, even though what I'm looking for is probably some way to dynamically set/send/extend variables/options.
A.html
<include src="B.html" locals='{
"location": "Los Angeles"
}'></include>
B.html
<include src="contact.html" locals='{
"location": {{ location }},
"department": "dep"
}'></include>
contact.html
<h1 class="{{ department }}">Hi {{ location }}</h1>
I'll close this for now, as I realize this is probably outside of the scope of this module :)