npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

partials-loader

v0.1.3

Published

Partials loader is a node module to faciliate the registering of partials with a respective template engine.

Readme

#partials-loader

Overview

This is a node module to help facilitate registering partials with their respective templating engine. In doing so it creates a namespace from the directory it is loaded from.

This means that when using this module you will be able to reference partials in your templates directory by providing the relative path from your template directory to the partial being loaded and handlebars will be aware of it.

Example Usage

First, pretend that we have a folder called
/Users/username/node project/

And in this folder there is this directory structure
/Users/username/node project/
|__templates
    |__example.hbs
    |__index.hbs
    |__more partials
        |__header.hbs
        |__content.html
        |__footers.hbs
    |__partials
        |__header.hbs
        |__content.html
        |__footers.hbs

Register all files from the templates folder

// First load your engine and the partials-loader
var handlebars = require('handlebar');
var partialLoader = require('partials-loader');

//  This registers every handlebar file 
partialLoader.handlebars({ template_engine_reference: handlebars, 
                            template_root_directories: '/Users/username/node project/templates',
                            partials_directory_names: '.',
                            template_extensions: 'hbs',
                            delimiter_symbol: '/'
                        });

This will result in handlebars having the registered partials:

  • templates/example
  • templates/index
  • templates/more partials/header
  • templates/more partials/footer
  • templates/partials/header
  • templates/partials/footer

Register files from a specific subfolder

// First load your engine and the partials-loader
var handlebars = require('handlebar');
var partialLoader = require('partials-loader');

//  This registers every handlebar file in the partials folder
partialLoader.handlebars({ template_engine_reference: handlebars, 
                            template_root_directories: '/Users/username/node project/templates',
                            partials_directory_names: 'partials',
                            template_extensions: 'hbs',
                            delimiter_symbol: '/'
                        });

This will result in handlebars having the registered partials:

  • templates/partials/header
  • templates/partials/footer

Register files from multiple specific subfolders

// First load your engine and the partials-loader
var handlebars = require('handlebar');
var partialLoader = require('partials-loader');

//  This registers every handlebar file in the specified folders
partialLoader.handlebars({ template_engine_reference: handlebars, 
                            template_root_directories: '/Users/username/node project/templates',
                            partials_directory_names: ['more partials', 'partials'],
                            template_extensions: 'hbs',
                            delimiter_symbol: '/'
                        });

This will result in handlebars having the registered partials:

  • templates/more partials/header
  • templates/more partials/footer
  • templates/partials/header
  • templates/partials/footer

Register multiple file types from multiple specific subfolders

// First load your engine and the partials-loader
var handlebars = require('handlebar');
var partialLoader = require('partials-loader');

//  This registers every handlebar file in the specified folders
partialLoader.handlebars({ template_engine_reference: handlebars, 
                            template_root_directories: '/Users/username/node project/templates',
                            partials_directory_names: ['more partials', 'partials'],
                            template_extensions: ['hbs', 'html'],
                            delimiter_symbol: '/'
                        });

This will result in handlebars having the registered partials:

  • templates/more partials/header
  • templates/more partials/content
  • templates/more partials/footer
  • templates/partials/header
  • templates/partials/content
  • templates/partials/footer

Currently Supported Template Engines

  • Handlebars

If there is a desire for supporting more engines, please post in the issues section of the repository, or feel free to implement it yourself and send a pull request for integration.