Next Phenomenal Microbrewery
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    heinzelmannchen-templatepublic

    Promises/A+ logo

    heinzelmannchen-template

    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

    CLI

      Usage: heinzel-template -t [template] -j [dataFile]
    
      Options:
    
        -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')
        .then(onProcessed)
        .fail(onFail);
     
    // 2. passing json data
    ht.template('mytemplate.tpl', {
            name: 'Anton'
        }).then(onProcessed)
        .fail(onFail);
     
    // 3. processing a string
    ht.process('<%= name %>', {
        name: 'Anton'
        }).then(onProcessed)
        .fail(onFail);

    Template

    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".

    Keywords

    none

    install

    npm i heinzelmannchen-template

    Downloadsweekly downloads

    22

    version

    1.0.6

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar