JSPM

  • Created
  • Published
  • Downloads 32829
  • Score
    100M100P100Q142614F

express.js inspired template-engine manager.

Package Exports

  • engine-cache

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 (engine-cache) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

engine-cache NPM version

express.js inspired template-engine manager.

Install

Install with npm

npm i engine-cache --save

Usage

var engines = require('engine-cache');

API

engines

Create a new instance of Engines, optionally passing the default options to use.

  • options {Object}: Default options to use.

Example:

var Engines = require('engine-cache')
var engines = new Engines()

.register

Register the given view engine callback fn as ext.

  • ext {String}
  • fn {Function|Object}: or options
  • options {Object}
  • returns {engines}: to enable chaining.
var consolidate = require('consolidate')
engines.register('hbs', consolidate.handlebars)

.load

Load an object of engines onto the cache. Mostly useful for testing, but exposed as a public method.

  • obj {Object}: Engines to load.
  • returns {engines}: to enable chaining.
engines.load(require('consolidate'))

.get

Return the engine stored by ext. If no ext is passed, the entire cache is returned.

  • ext {String}: The engine to get.
  • returns {Object}: The specified engine.
var consolidate = require('consolidate')
engine.set('hbs', consolidate.handlebars)
engine.get('hbs')
// => {render: [function], renderFile: [function]}

.clear

Remove ext from the cache, or if no value is specified the entire cache is reset.

Example:

engines.clear()

.option

Set or get an option.

  • key {String}
  • value {*}
  • returns {engines}: to enable chaining.
engines.option('a', true)
engines.option('a')
// => true

.extend

Extend the options with the given obj.

  • obj {Object}
  • returns {engines}: to enable chaining.
engines.extend({a: 'b'})
engines.option('a')
// => 'b'

Author

Jon Schlinkert

License

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


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