# engine-cache

> express.js inspired template-engine manager.

Latest version **1.0.1** (published 2017-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install engine-cache
pnpm add engine-cache
yarn add engine-cache
bun add engine-cache
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-04-20 |
| First published | 2014-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert, doowb |
| Keywords | assemble, cache, compile, consolidate, content, data, delimiters, delims, docs, documentation, engine, engines, express, front, generate, generator, lo-dash, lodash, markdown, matter, noop, parse, parser, parsers, pass-through, process, render, template, templates, underscore, verb, yaml |

## Links

- npm: https://www.npmjs.com/package/engine-cache
- Repository: https://github.com/jonschlinkert/engine-cache
- Issues: https://github.com/jonschlinkert/engine-cache/issues
- npm.io page: https://npm.io/package/engine-cache

## Dependencies (5)

- [isobject](https://npm.io/package/isobject.md) ^3.0.0
- [mixin-deep](https://npm.io/package/mixin-deep.md) ^1.2.0
- [helper-cache](https://npm.io/package/helper-cache.md) ^1.0.0
- [async-helpers](https://npm.io/package/async-helpers.md) ^0.3.14
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^2.0.1

## Alternatives

- [monaco-yaml](https://npm.io/package/monaco-yaml.md) — 420.1K weekly downloads
- [@crewx/workflow](https://npm.io/package/@crewx/workflow.md) — 3.1K weekly downloads
- [yaml-cat](https://npm.io/package/yaml-cat.md) — 38 weekly downloads
- [nunjucks-in-yaml](https://npm.io/package/nunjucks-in-yaml.md) — 9 weekly downloads
- [shopify-symlinks](https://npm.io/package/shopify-symlinks.md) — 3 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-04-20
- 1.0.0 — 2017-04-20
- 0.19.4 — 2017-02-21
- 0.19.3 — 2017-02-20
- 0.19.2 — 2017-01-17
- 0.19.1 — 2016-07-08
- 0.18.1 — 2016-07-08
- 0.19.0 — 2016-06-27
- 0.18.0 — 2016-06-01
- 0.17.0 — 2016-05-30
- 0.16.2 — 2016-05-13
- 0.16.1 — 2015-09-30
- 0.16.0 — 2015-09-20
- 0.15.0 — 2015-09-17
- 0.14.1 — 2015-08-21
- … 36 more at https://npm.io/package/engine-cache/versions

## README

# engine-cache [![NPM version](https://img.shields.io/npm/v/engine-cache.svg?style=flat)](https://www.npmjs.com/package/engine-cache) [![NPM monthly downloads](https://img.shields.io/npm/dm/engine-cache.svg?style=flat)](https://npmjs.org/package/engine-cache)  [![NPM total downloads](https://img.shields.io/npm/dt/engine-cache.svg?style=flat)](https://npmjs.org/package/engine-cache) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/engine-cache.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/engine-cache) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/engine-cache.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/engine-cache)

> express.js inspired template-engine manager.

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save engine-cache
```

Install with [yarn](https://yarnpkg.com):

```sh
$ yarn add engine-cache
```

## Usage

```js
var Engines = require('engine-cache');
```

## API

### [Engines](index.js#L26)

**Params**

* `engines` **{Object}**: Optionally pass an object of engines to initialize with.

**Example**

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

### [.setEngine](index.js#L48)

Register the given view engine callback `fn` as `ext`.

**Params**

* `ext` **{String}**
* `options` **{Object|Function}**: or callback `fn`.
* `fn` **{Function}**: Callback.
* `returns` **{Object}** `Engines`: to enable chaining.

**Example**

```js
var consolidate = require('consolidate')
engines.setEngine('hbs', consolidate.handlebars)
```

### [.setEngines](index.js#L82)

Add an object of engines onto `engines.cache`.

**Params**

* `obj` **{Object}**: Engines to load.
* `returns` **{Object}** `Engines`: to enable chaining.

**Example**

```js
engines.setEngines(require('consolidate'))
```

### [.getEngine](index.js#L109)

Return the engine stored by `ext`. If no `ext` is passed, undefined is returned.

**Params**

* `ext` **{String}**: The engine to get.
* `returns` **{Object}**: The specified engine.

**Example**

```js
var consolidate = require('consolidate');
var engine = engine.setEngine('hbs', consolidate.handlebars);

var engine = engine.getEngine('hbs');
console.log(engine);
// => {render: [function], renderFile: [function]}
```

### [.helpers](index.js#L140)

Get and set helpers for the given `ext` (engine). If no `ext` is passed, the entire helper cache is returned.

**Example:**

See [helper-cache](https://github.com/jonschlinkert/helper-cache) for any related issues, API details, and documentation.

**Params**

* `ext` **{String}**: The helper cache to get and set to.
* `returns` **{Object}**: Object of helpers for the specified engine.

**Example**

```js
var helpers = engines.helpers('hbs');
helpers.addHelper('bar', function() {});
helpers.getEngineHelper('bar');
helpers.getEngineHelper();
```

## Changelog

**v0.19.0** ensure the string is only rendered once by passing the compiled function to the `render` method

**v0.18.0** the `.load` method was renamed to `.setHelpers`

**v0.16.0** the `.clear()` method was removed. A custom `inspect` method was added.

**v0.15.0** `.getEngine()` no longer returns the entire `cache` object when `ext` is undefined.

## About

### Related projects

* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
* [async-helpers](https://www.npmjs.com/package/async-helpers): Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and… [more](https://github.com/doowb/async-helpers) | [homepage](https://github.com/doowb/async-helpers "Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and Lodash have been tested.")
* [engines](https://www.npmjs.com/package/engines): Template engine library with fast, synchronous rendering, based on consolidate. | [homepage](https://github.com/assemble/engines "Template engine library with fast, synchronous rendering, based on consolidate.")
* [helper-cache](https://www.npmjs.com/package/helper-cache): Easily register and get helper functions to be passed to any template engine or node.js… [more](https://github.com/jonschlinkert/helper-cache) | [homepage](https://github.com/jonschlinkert/helper-cache "Easily register and get helper functions to be passed to any template engine or node.js application. Methods for both sync and async helpers.")
* [templates](https://www.npmjs.com/package/templates): System for creating and managing template collections, and rendering templates with any node.js template engine… [more](https://github.com/jonschlinkert/templates) | [homepage](https://github.com/jonschlinkert/templates "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Contributors

| **Commits** | **Contributor** | 
| --- | --- |
| 113 | [jonschlinkert](https://github.com/jonschlinkert) |
| 51 | [doowb](https://github.com/doowb) |

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 20, 2017._

---
_Source: https://npm.io/package/engine-cache · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
