Liquid - switch statement with a variable -


i have following situation:

<label for="swatch-{{ option_index }}-{{ value | handle }}" style="background-color:          {% capture color %} {{ value | handle }} {% endcapture %}        {% assign handle = color %}         {% case handle %}           {% when 'red' %}              red;           {% when 'navy' %}              navy;           {% else %}              #f00;         {% endcase %}  background-image: url({{ value | handle | append: '.' | append: file_extension | file_url }})"> 

when {{color}} prints right color, when try use in comparison statement fails, returns blank (or rather default #f00. same if statement.

if define

{% assign handle = 'red' %} 

then works fine.

have tried using {{ value | handleize }} ? far i'm aware "handle" not right operator.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -