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 = options;
options
referenceDir: '.' // Directory path from which to reference the registered partials
Register a file as a Handlebars partial
hbsPartialFile;
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;
args
dirPath
- Directory path whose files to include.
ext
- (Optional) Permitted file extension, or *
. If omitted, all files would be included.