Member-only story
Test Liquid Template with Live Preview
This blog is about how to test or debug the liquid template during the development from local work station.
If you are working on integration application where you need to map source data to destination data, Liquid template is great tool to write those mapping logic.
You can map source data like XML, json, CSV into destination format like XML, JSON, HTML etc.
https://shopify.dev/api/liquid
It’s very quick and easy tool to learn, the issue I had with this was to test it on local work station I did not found any way uptil now to test those on my machine.
Now I found it so I will be sharing it here in this blog today 😁
LivePreview Liquid Template
To preview the result of your liquid map you can simply download AzureLiquid.Preview using dotnet tool command
dotnet tool install -g AzureLiquid.Preview
to update you can use
dotnet tool update -g AzureLiquid.Preview
Command has following argument
Argument
Description
–help
Shows help description within the console
–watch
Switch parameter to enable file watcher and produce output on file update
–template
Relative path to the .liquid template source file
–content
Relative path to the XML or JSON data source file
–output
Relative path to the output result file
To use the template preview you can run the following command
liquidpreview --watch --content ./sample.json --template ./template.liquid --output ./output.json

That will generate the output.json as test result

The good thing is this run on live mode, this means that while running the command if you make changes to the input data or liquid…