engine-cache
Advanced tools
Comparing version 0.12.1 to 0.12.2
14
index.js
'use strict'; | ||
var extend = require('extend-shallow'); | ||
var AsyncHelpers = require('async-helpers'); | ||
var Helpers = require('helper-cache'); | ||
var async = require('async'); | ||
var _ = require('lodash'); | ||
@@ -83,3 +83,3 @@ /** | ||
engine.options = _.merge({}, engine.options, fn.options, options); | ||
engine.options = extend({}, engine.options, fn.options, options); | ||
engine.helpers = new Helpers(options); | ||
@@ -93,5 +93,5 @@ engine.asyncHelpers = new AsyncHelpers(options); | ||
if (engine.render) { | ||
engine.name = engine.render.name || 'unknown'; | ||
engine.name = engine.render.name; | ||
} else { | ||
engine.name = engine.renderSync.name || 'unknown'; | ||
engine.name = engine.renderSync.name; | ||
} | ||
@@ -185,3 +185,3 @@ | ||
var opts = _.extend({async: true}, options); | ||
var opts = extend({async: true}, options); | ||
var ctx = mergeHelpers.call(this, opts); | ||
@@ -208,3 +208,3 @@ var self = this; | ||
opts = opts || {}; | ||
opts.helpers = _.merge({}, this.helpers, opts.helpers); | ||
opts.helpers = extend({}, this.helpers, opts.helpers); | ||
return renderSync(str, opts); | ||
@@ -324,5 +324,5 @@ }; | ||
function mergeHelpers (opts) { | ||
_.merge(this.asyncHelpers.helpers, this.helpers, opts.helpers); | ||
extend(this.asyncHelpers.helpers, this.helpers, opts.helpers); | ||
opts.helpers = this.asyncHelpers.get({wrap: opts.async}); | ||
return opts; | ||
} |
{ | ||
"name": "engine-cache", | ||
"description": "express.js inspired template-engine manager.", | ||
"version": "0.12.1", | ||
"version": "0.12.2", | ||
"homepage": "https://github.com/jonschlinkert/engine-cache", | ||
@@ -29,6 +29,3 @@ "author": { | ||
}, | ||
"license": { | ||
"type": "MIT", | ||
"url": "https://github.com/jonschlinkert/engine-cache/blob/master/LICENSE" | ||
}, | ||
"license": "MIT", | ||
"files": [ | ||
@@ -45,6 +42,6 @@ "index.js" | ||
"dependencies": { | ||
"async": "^0.9.0", | ||
"async-helpers": "^0.2.0", | ||
"helper-cache": "^0.7.0", | ||
"lodash": "^3.7.0" | ||
"async": "^1.1.0", | ||
"async-helpers": "^0.2.2", | ||
"extend-shallow": "^1.1.4", | ||
"helper-cache": "^0.7.1" | ||
}, | ||
@@ -51,0 +48,0 @@ "devDependencies": { |
@@ -1,9 +0,9 @@ | ||
# engine-cache [![NPM version](https://badge.fury.io/js/engine-cache.svg)](http://badge.fury.io/js/engine-cache) [![Build Status](https://travis-ci.org/jonschlinkert/engine-cache.svg)](https://travis-ci.org/jonschlinkert/engine-cache) | ||
# engine-cache [![NPM version](https://badge.fury.io/js/engine-cache.svg)](http://badge.fury.io/js/engine-cache) [![Build Status](https://travis-ci.org/jonschlinkert/engine-cache.svg)](https://travis-ci.org/jonschlinkert/engine-cache) | ||
> express.js inspired template-engine manager. | ||
## Install with [npm](npmjs.org) | ||
Install with [npm](https://www.npmjs.com/) | ||
```bash | ||
npm i engine-cache --save | ||
```sh | ||
$ npm i engine-cache --save | ||
``` | ||
@@ -18,6 +18,11 @@ | ||
## API | ||
### [Engines](index.js#L24) | ||
* `engines` **{Object}**: Optionally pass an object of engines to initialize with. | ||
**Params** | ||
* `engines` **{Object}**: Optionally pass an object of engines to initialize with. | ||
**Example** | ||
```js | ||
@@ -32,7 +37,11 @@ var Engines = require('engine-cache'); | ||
* `ext` **{String}** | ||
* `options` **{Object|Function}**: or callback `fn`. | ||
* `fn` **{Function}**: Callback. | ||
* `returns` **{Object}** `Engines`: to enable chaining. | ||
**Params** | ||
* `ext` **{String}** | ||
* `options` **{Object|Function}**: or callback `fn`. | ||
* `fn` **{Function}**: Callback. | ||
* `returns` **{Object}** `Engines`: to enable chaining. | ||
**Example** | ||
```js | ||
@@ -47,5 +56,9 @@ var consolidate = require('consolidate') | ||
* `ext` **{String}**: The engine to get. | ||
* `returns` **{Object}**: The specified engine. | ||
**Params** | ||
* `ext` **{String}**: The engine to get. | ||
* `returns` **{Object}**: The specified engine. | ||
**Example** | ||
```js | ||
@@ -63,5 +76,9 @@ var consolidate = require('consolidate') | ||
* `obj` **{Object}**: Engines to load. | ||
* `returns` **{Object}** `Engines`: to enable chaining. | ||
**Params** | ||
* `obj` **{Object}**: Engines to load. | ||
* `returns` **{Object}** `Engines`: to enable chaining. | ||
**Example** | ||
```js | ||
@@ -75,7 +92,13 @@ engines.load(require('consolidate')) | ||
* `ext` **{String}**: The helper cache to get and set to. | ||
* `returns` **{Object}**: Object of helpers for the specified engine. | ||
**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 | ||
@@ -88,4 +111,2 @@ var helpers = engines.helpers('hbs'); | ||
See [helper-cache] for any related issues, API details, and documentation. | ||
### [.clear](index.js#L303) | ||
@@ -95,6 +116,10 @@ | ||
* `ext` **{String}**: The engine to remove. | ||
**Example:** | ||
**Params** | ||
* `ext` **{String}**: The engine to remove. | ||
**Example** | ||
```js | ||
@@ -105,33 +130,37 @@ engines.clear() | ||
## Related | ||
* [async-helpers](https://github.com/doowb/async-helpers): Use async helpers in templates with engines that typically only… [more](https://github.com/doowb/async-helpers) | ||
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost… [more](https://github.com/assemble/handlebars-helpers) | ||
* [helper-cache](https://github.com/jonschlinkert/helper-cache): Easily register and get helper functions to be passed to… [more](https://github.com/jonschlinkert/helper-cache) | ||
* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template… [more](https://github.com/jonschlinkert/template-helpers) | ||
* [template](https://github.com/jonschlinkert/template): Render templates from any engine. Make custom template types, use… [more](https://github.com/jonschlinkert/template) | ||
* [async-helpers](https://github.com/doowb/async-helpers): Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and… [more](https://github.com/doowb/async-helpers) | ||
* [helper-cache](https://github.com/jonschlinkert/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) | ||
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes… [more](https://github.com/assemble/handlebars-helpers) | ||
* [template](https://github.com/jonschlinkert/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://github.com/jonschlinkert/template) | ||
* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… [more](https://github.com/jonschlinkert/template-helpers) | ||
## Running tests | ||
Install dev dependencies: | ||
```bash | ||
npm i -d && npm test | ||
```sh | ||
$ npm i -d && npm test | ||
``` | ||
## Contributing | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/engine-cache/issues) | ||
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/engine-cache/issues/new) | ||
## Author | ||
**Jon Schlinkert** | ||
[github/jonschlinkert](https://github.com/jonschlinkert) | ||
[twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
Copyright (c) 2014-2015 Jon Schlinkert | ||
Released under the MIT license | ||
Copyright © 2014-2015 Jon Schlinkert | ||
Released under the MIT license. | ||
*** | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 23, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 01, 2015._ | ||
[helper-cache]: https://github.com/jonschlinkert/helper-cache | ||
<!-- deps: swig lodash mocha engine-lodash handlebars --> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14903
159
+ Addedextend-shallow@^1.1.4
+ Addedasync@1.5.2(transitive)
+ Addedextend-shallow@1.1.4(transitive)
+ Addedkind-of@1.1.0(transitive)
- Removedlodash@^3.7.0
- Removedlodash@3.10.1(transitive)
Updatedasync@^1.1.0
Updatedasync-helpers@^0.2.2
Updatedhelper-cache@^0.7.1