JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28429
  • Score
    100M100P100Q166064F

Load template engine helpers (handlebars, lo-dash, etc) from file paths, globs, arrays or objects.

Package Exports

  • load-helpers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (load-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

load-helpers NPM version

Load template engine helpers (handlebars, lo-dash, etc) from file paths, globs, arrays or objects.

Install

Install with npm:

npm i load-helpers --save-dev

Usage

var loader = require('load-helpers');

API

loader

  • options {Object}: Default options for front-matter and helper naming.
var loader = require('load-helpers');

.option

Set or get an option.

  • key {String}: The name of the option.
  • value {*}: The value to assign.
  • returns: {*}
loader.option('a', true)
loader.option('a')
// => true

.load

Resolve and load helpers onto the cache.

  • returns {Object} loader
// require a helper
loader.load(require('foo'));

// Pass a string or array of file paths or glob patterns
loader.load('a.js');
loader.load(['a.js', 'b.js', 'c.js']);
loader.load(['*.js']);

// pass an object
loader.load({
 a: function (str) {
   return str;
  }
});

// pass an array of objects
helper.load([{
  a: function (str) {
   return str;
  },
  b: function (str) {
   return str;
  }
}]);

.set

Store a helper on the cache by name.

  • name {String}: Helper name
  • helper {String}: File path, glob pattern or object.
loader.set('foo', function(str) {
  return str;
})

.get

Get helper from the cache.

  • helper {String}: The name of the helper to get.
loader.get('foo')
//=> [function]

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license


This file was generated by verb-cli on August 29, 2014.