Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pbrisbin/liquid-cli

CLI interface for rendering Liquid templates
https://github.com/pbrisbin/liquid-cli

Last synced: 2 months ago
JSON representation

CLI interface for rendering Liquid templates

Awesome Lists containing this project

README

        

# Liquid-CLI

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

[liquid]: https://github.com/Shopify/liquid

## 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)" <{{ title }}
{% for post in posts %}
{{ post.content }}
{% endfor %}
EOF