Project

liquid-cli

0.0
No commit activity in last 3 years
No release in over 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
 Dependencies

Development

~> 1.3
>= 0

Runtime

>= 0
 Project Readme

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