https://github.com/realorko/nodejs-handlebars-cli
A nodejs cli for transforming handlebars templates using yml files as input
https://github.com/realorko/nodejs-handlebars-cli
Last synced: over 1 year ago
JSON representation
A nodejs cli for transforming handlebars templates using yml files as input
- Host: GitHub
- URL: https://github.com/realorko/nodejs-handlebars-cli
- Owner: RealOrko
- Created: 2020-07-26T14:07:54.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T20:50:58.000Z (over 3 years ago)
- Last Synced: 2025-01-21T17:16:38.231Z (over 1 year ago)
- Language: JavaScript
- Size: 195 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Handlebars CLI
A simple implementation of a handlebars CLI with globbing capabilities.
## Prerequisites
You must make sure you have the following pre-requisites installed:
- [nodejs](https://nodejs.org/en/download/package-manager/)
#### Using source
```
git clone https://github.com/RealOrko/handlebars-cli.git && cd handlebars-cli && npm install -g . && hb --help
```
#### Using npm
```
npm install https://github.com/RealOrko/nodejs-handlebars-cli.git -g --force
```
#### Using package
Or alternatively you can use the latest [published package](https://github.com/RealOrko/nodejs-handlebars-cli/packages/).
## Guide
## Examples
All examples can be run from the root folder for where this repository is checked out.
To see the effects of:
- One template to one input
- Many templates to one input
- One template to many inputs
- Many templates to many inputs
Please run `test/test.sh` and navigate to the output in `build/`.
#### Help
```
hb --help
```
#### Single transform
```
hb -t examples/bands.yml.hbs -i examples/bands.yml -o build/single-template-with-single-input-with-file-output/bands.yml
hb -t examples/fruits.yml.hbs -i examples/fruits.yml -o build/single-template-with-single-input-with-file-output/fruits.yml
```
#### Single transform (stdout)
```
hb -t examples/bands.yml.hbs -i examples/bands.yml -s true > build/single-template-with-single-input-with-std-output/bands.yml
hb -t examples/fruits.yml.hbs -i examples/fruits.yml -s true > build/single-template-with-single-input-with-std-output/fruits.yml
```
#### Single template transform with glob inputs
```
hb -t examples/bands.yml.hbs -i examples/**/*.yml -o build/single-template-with-glob-input-with-file-output/bands.yml
hb -t examples/fruits.yml.hbs -i examples/**/*.yml -o build/single-template-with-glob-input-with-file-output/fruits.yml
```
#### Single template transform with glob inputs (stdout)
```
hb -t examples/bands.yml.hbs -i examples/**/*.yml -s true > build/single-template-with-glob-input-with-std-output/bands.yml
hb -t examples/fruits.yml.hbs -i examples/**/*.yml -s true > build/single-template-with-glob-input-with-std-output/fruits.yml
```
#### Multiple template transform with single input
```
hb -t examples/**/*.yml.hbs -i examples/all.yml -o build/glob-template-with-single-input-with-file-output/bands.yml
hb -t examples/**/*.yml.hbs -i examples/all.yml -o build/glob-template-with-single-input-with-file-output/fruits.yml
```
#### Multiple template transform with single input (stdout)
```
hb -t examples/**/*.yml.hbs -i examples/all.yml -s true > build/glob-template-with-single-input-with-std-output/bands.yml
hb -t examples/**/*.yml.hbs -i examples/all.yml -s true > build/glob-template-with-single-input-with-std-output/fruits.yml
```
#### Multiple template transform with multiple inputs
```
hb -t examples/**/*.yml.hbs -i examples/**/*.yml -o build/glob-template-with-glob-input-with-file-output/bands.yml
hb -t examples/**/*.yml.hbs -i examples/**/*.yml -o build/glob-template-with-glob-input-with-file-output/fruits.yml
```
#### Multiple template transform with multiple inputs (stdout)
```
hb -t examples/**/*.yml.hbs -i examples/**/*.yml -s true > build/glob-template-with-glob-input-with-std-output/bands.yml
hb -t examples/**/*.yml.hbs -i examples/**/*.yml -s true > build/glob-template-with-glob-input-with-std-output/fruits.yml
```