handlebars-dir-render
Given a context and a source directory of handlebars templates, recursively renders all files from source directory to destination directory.
Strips and *.hbs
& *.handlebars
extensions from source directory.
Installation
npm install handlebars-dir-render
Usage
;;
or
const render = render;;
API
/** * Recursively renders template files in srcDir to dstDir. * Strips any *.hbs and *.handlebars extensions from source files. * Provides the ability to filter files in source directory. * * @param srcDir source directory with template * @param dstDir destination directory * @param context The handlerbars context object * @param filter (optional) function to filter files. Defaults to null - all files are processed. * signature: ({path: string, stats: fstats}) => boolean * @param options (optional) { handlebars: anHandlebarsInstance, hb_options: handlebar-options } */async function render ( srcDir: string, dstDir: string, context: any, filter: (File) => boolean = null, options: Options = null): Promise<string[]>
License
Apache-2.0
Support
Bugs, PRs, comments, suggestions welcomed!