Project

liquid-cli

0.0
Repository is archived
No release in over 3 years
Low commit activity in last 3 years
Command line interface to the Liquid gem by Shopify
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.3
>= 0

Runtime

>= 0
 Project Readme

Note

All of my GitHub repositories have been archived and will be migrated to Codeberg as I next work on them. This repository either now lives, or will live, at:

https://codeberg.org/pbrisbin/liquid-cli

If you need to report an Issue or raise a PR, and this migration hasn't happened yet, send an email to me@pbrisbin.com.

Liquid-CLI

A command-line wrapper over the liquid ruby library by Shopify.

Installation

$ gem install liquid-cli

Usage

Supply a template on stdin and an optional context as JSON.

$ echo 'Hi, my name is {{ name }}.' | liquid '{ "name": "Pat" }'
Hi, my name is Pat.

Use shell redirection to make handling larger templates and contexts easier:

$ cat context.json
{
  "title": "A title",
  "posts": [
    {
      "link": "/posts/foo",
      "content": "Foo"
    },
    {
      "link": "/posts/bar",
      "content": "Bar"
    }
  ]
}

$ liquid "$(< context.json)" <<EOF
<h1>{{ title }}</h1>
{% for post in posts %}
  <a href="{{ post.link }}">{{ post.content }}</a>
{% endfor %}
EOF