feat: CLI support

echo '{{ "hello" | capitalize }}' | liquidjs
This commit is contained in:
harttle
2019-08-01 13:15:55 +08:00
parent c8c6dd8275
commit fc045b5bbc
4 changed files with 44 additions and 0 deletions
Executable
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env node
const Liquid = require('..')
let tpl = ''
process.stdin.on('data', chunk => (tpl += chunk))
process.stdin.on('end', () => render(tpl))
async function render (tpl) {
const liquid = new Liquid()
const html = await liquid.parseAndRender(tpl)
console.log(html)
}