mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
fix: restore explicit @- stdin for template and context
Keep @- for --template and --context; only the legacy bare-stdin-as-template fallback stays removed. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
@@ -59,13 +59,14 @@ LiquidJS can also be used to render a template directly from CLI using `npx`:
|
||||
npx liquidjs --template '{{"hello" | capitalize}}'
|
||||
```
|
||||
|
||||
You can either pass the template inline (as shown above) or you can read it from a file by using the `@` character followed by a path, like so:
|
||||
You can either pass the template inline (as shown above), read it from a file with `@` followed by a path, or from `stdin` with `@-`:
|
||||
|
||||
```bash
|
||||
npx liquidjs --template @./some-template.liquid
|
||||
echo '{{"hello" | capitalize}}' | npx liquidjs --template @-
|
||||
```
|
||||
|
||||
A context can be passed inline, from a path, or piped through `stdin`. The following three are equivalent:
|
||||
A context can be passed the same ways (inline, from a path, or via `@-` for `stdin`). The following three are equivalent:
|
||||
|
||||
```bash
|
||||
npx liquidjs --template 'Hello, {{ name }}!' --context '{"name": "Snake"}'
|
||||
@@ -73,6 +74,8 @@ npx liquidjs --template 'Hello, {{ name }}!' --context @./some-context.json
|
||||
echo '{"name": "Snake"}' | npx liquidjs --template 'Hello, {{ name }}!' --context @-
|
||||
```
|
||||
|
||||
Note that you can only use the `stdin` specifier `@-` for a single argument. If you try to use it for both `--template` and `--context` you will get an error.
|
||||
|
||||
The rendered output is written to `stdout` by default, but you can also specify an output file (if the file exists, it will be overwritten):
|
||||
|
||||
```bash
|
||||
|
||||
Reference in New Issue
Block a user