https://github.com/pbrisbin/liquid-cli
CLI interface for rendering Liquid templates
https://github.com/pbrisbin/liquid-cli
Last synced: about 1 month ago
JSON representation
CLI interface for rendering Liquid templates
- Host: GitHub
- URL: https://github.com/pbrisbin/liquid-cli
- Owner: pbrisbin
- License: mit
- Created: 2013-10-04T15:05:17.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-10-04T15:05:21.000Z (over 11 years ago)
- Last Synced: 2025-05-07T10:34:33.800Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 105 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
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