You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for your incredible work here !
I am using this lib within an api and I want to implement a function which takes in argument the twig template and return the list of the variables needed to compile/render the twig.
I have been looking at the source code to find any way to achieve this, but so far I didn't find any solution.
Did someone already implemented this kind of function ?
Thank you.
The text was updated successfully, but these errors were encountered:
I think your best bet would be to use the included Twig parser to get the nodes that your template is made of, and isolate the nodes that handle the variable assignment. It should be easy enough.
You can start by looking at that project I wrote some time ago, that transpiles Twig template to PHTML templates. To achieve this, it uses Twing parser to walk through the nodes:
With Twing, the nodes that handle variables (both assignment ans output) are node instanceof TwingNodeExpressionName and TwingNodeExpressionAssignName.
This should be a fun tool to write actually. Let me know how it goes.
Hello Guys,
First of all, thank you for your incredible work here !
I am using this lib within an api and I want to implement a function which takes in argument the twig template and return the list of the variables needed to compile/render the twig.
I have been looking at the source code to find any way to achieve this, but so far I didn't find any solution.
Did someone already implemented this kind of function ?
Thank you.
The text was updated successfully, but these errors were encountered: