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
There is a way, but now there's no AST definition, that means the way to access the parsed tokens is implementation specific and subject to change. For example the following code outputs what you mentioned above:
const{ Liquid }=require('liquidjs')constengine=newLiquid()consttpls=engine.parse(`{{bucket}}{% for product in products %} {{ product.name }} ads{% endfor %}`)console.log(tpls[1].token.content)// outputs: bucketconsole.log(tpls[3].impl.templates[1].token.content)// outputs: product.name
Note that the name .impl is defined in for implementation, and the way to access children nodes can be different for each tag. And tpls[0] is represents \n before the first output {{bucket}}.
Uh oh!
There was an error while loading. Please reload this page.
Hello.
I need to parse all outputs from template.
So I want to get array like
["bucket", "product.name"]
or something like that.How can I do it?
The text was updated successfully, but these errors were encountered: