hb-interpolate

Interpolate a json file through a Handlebars template file to stdout.

Usage no npm install needed!

<script type="module">
  import hbInterpolate from 'https://cdn.skypack.dev/hb-interpolate';
</script>

README

hb-interpolate

Interpolate a json file through a Handlebars template file to stdout.

Build Status

About

hb-interpolate is a very simple command line tool that reads a .json file and a Handlebars template file, and then writes the implied interpolation to stdout.

Usage

$ hb-interpolate --help

  Usage: hb-interpolate [options]

  Options:

    -h, --help             output usage information
    -j, --json [path]      JSON file with input data
    -t, --template [path]  Handlebars template to interpolate
    -n, --noEscape         Don't do HTML escaping

If the JSON file is a package.json, read-package-json is used to read the file.
Note that read-package-json normalizes some fields.
  `--json [path]` and `--tempate [path]` are REQUIRED.

Notes

  • The --json [path] and --template [path] arguments are required.
  • If the basename of the json path is package.json, hb-interpolate uses the node package read-package-json to read the file, which normalizes some fields, in particular all people fields. Any other json file is returned directly as read.
  • The --noEscape option may be used to turn off Handlebars HTML escaping.