New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

handlebars-dir-render

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-dir-render

Renders a template source directory to a destination directory, with a given context

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

handlebars-dir-render

npm license travis status Build status Coverage Status David David
NPM

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

import { render } from 'handlebars-dir-render';
render(srcDir, dstDir, context);

or

const render = require('handlebars-dir-render').render;
render(srcDir, dstDir, context);

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!

Keywords

Handlebars

FAQs

Package last updated on 04 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts