Skip to content
Mike Bridge edited this page Nov 10, 2015 · 24 revisions

Differences from Shopify Liquid:

Incompatibilities

Truth tests are slightly different between Shopify Liquid and Liquid.NET.

There is no such thing as a "drop" or any other special class in the Liquid.NET context. Anything that looks like an object is a hash.

You can't currently define keywords within custom tag blocks. All values passed to a custom tag must be value literals or variables. For example, you can't create a tag that would parse {% while item in myitems %} ... {% endwhile %}. You could, however, create {% while 'item' myitems %} ... {% endwhile %} instead.

Additions

Conditional Grouping

Liquid.NET can group if expressions using parentheses, which is not currently possible in liquid. [also].

    {% if (false and true) or true %}Result #1 is true{% endif %}
    {% if false and (true or true) %}Result #2 is true{% endif %}

==> Result #1 is true

You can negate an expression with not:

    {% if not false %}Not false is true.{% endif %}

===> Not false is true.

Macros

You can define your own tags dynamically using the macro tag.

{% macro echoargs arg1 %}
   You said "{{ arg1 }}"
{% endmacro %}
{% echoargs "HELLO" %}
==>
   You said "HELLO"

Macros are parsed during compilation time, but includes are parsed at rendering time.