template engine

Usage no npm install needed!

<script type="module">
  import heinzelmannchenTemplate from 'https://cdn.skypack.dev/heinzelmannchen-template';


Promises/A+ logo


heinzel-template is part of heinzelmannchen. It is a CLI- and node tool to process template files. It uses underscore as the templateeninge of choice.

Build Status



  Usage: heinzel-template -t [template] -j [dataFile]


    -h, --help              output usage information
    -t, --template [value]  the template
    -j, --json [value]      a json-file containing the data
    -s, --script [value]    load a custom js-script, to use in a templat under the global _custom
    -o, --output [value]    output filename
    -e, --encoding [value]  encoding of the files
    -s, --silent            no console output
    -f, --force             create folders if not existing
    -d, --dry-run           don't create files
    -D, --debug             print error object
    -T, --trace             print stacktrace
    -V, --version           output the version number

Node module

var ht = require('heinzel-template');

// 1. passing files
ht.template('mytemplate.tpl', 'data.json')

// 2. passing json data
ht.template('mytemplate.tpl', {
        name: 'Anton'

// 3. processing a string
ht.process('<%= name %>', {
    name: 'Anton'


The templateengine under the hood is underscorejs. By default it uses ERB-style. Additional to the functionality provided by undescorejs you can use underscorejs.string or load your own module, which will be available under "_custom".