Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- 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: 2024-11-02T08:31:02.352Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 105 KB
- Stars: 11
- Watchers: 4
- 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