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
Unfortunately no. But I agree this would be a good feature, given all the discussions I see here: Shopify/liquid#236
While the implementation would be changing the fundamental syntax, expect this feature won't come anytime soon. I'll leave this issue open for people to track.
@sanketdhoble Not sure if it helps, but I've generally used a custom filter similar to this in the past:
import{Liquid}from"liquidjs";constengine=newLiquid();engine.registerFilter("ternary",(value,truthyValue,falsyValue)=>!!value ? truthyValue : falsyValue);engine.parseAndRender('{{ data.age < 18 | ternary: "You are under 18", "You are over 18" }}',{data: {age: 8}}).then(console.log);// outputs 'You are under 18'
Does liquid js support one-liner conditional msg using ternary operator?
e.g: I want to do something like this but it doesn't work.
The text was updated successfully, but these errors were encountered: