Invoke a function variable #580
Unanswered
oscarotero
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Hi @oscarotero , we don't use const liquid = new Liquid()
const tpl = `{% assign foo = bar %}foo: {{ foo }}`
const ctx = { bar: () => 'BAR' }
const html = await liquid.parseAndRender(tpl, ctx)
expect(html.trim()).to.equal('foo: BAR') We added this feature in #222 , it should be available since a very old version. Try it! |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi. In a Nunjucks template I have some variables that are functions, that I can invoke to get the final value. For example:
The same code in Liquid throws an error:
I guess this is not supported in liquidjs. Is there any way to run functions in a template. I think it's a very useful feature.
Beta Was this translation helpful? Give feedback.
All reactions