Comments, Variables and Functions in Clerk.js

screenshot_2020-05-18_at_14.40.23.png

We have just released the newest version of Clerk.js with a handy set of features for frontend developers.

Our template engine in Clerk.js is based on the Liquid template language and we have now added support for the following things:

Comments

You can now inline comments in your template with {% comment %} this is my comment {% endcomment %}.

Variable Assignment

You can now define new variables anywhere in your template with the assign keyword.

This can greatly help you reduce duplicated code by checking for something once and using it anywhere {% assign on_sale = product.price < product.list_price %}.

Functions

More complex calculations can now be handled by pure JavaScript functions by defining them in Clerk.js as globals and call them directly from any expression in the template.