handlebars-partial-file

1.0.0 • Public • Published

Description

Helper utility for including files as Handlebars template partials. handlebars-partial-file reads a file's contents and registers it as a partial for use within a Handlebars template.

Installation

npm install handlebars-partial-file

Usage

Require the package and initialize options:
const hbsPartialFile = require('handlebars-partial-file')(options);

options

{
    referenceDir: '.' // Directory path from which to reference the registered partials
}
Register a file as a Handlebars partial
hbsPartialFile.registerFile(filepath, [nameOfPartial]);

args
filepath - The file path to include as partial.
nameOfPartial - (Optional) Name to register the partial as. If omitted, the file name will be used.

Register a directory whose files are to be registered as Handlebars partials
hbsPartialFile.registerDirectory(dirPath, ext);

args
dirPath - Directory path whose files to include.
ext - (Optional) Permitted file extension, or *. If omitted, all files would be included.

Readme

Keywords

Package Sidebar

Install

npm i handlebars-partial-file

Weekly Downloads

2

Version

1.0.0

License

ISC

Last publish

Collaborators

  • ikmich