Skip to content

ikmich/handlebars-partial-file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

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.

About

Helper utility for including files as Handlebars template partials

Resources

Stars

Watchers

Forks

Packages

No packages published