Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

templates

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

templates - npm Package Compare versions

Comparing version 0.25.3 to 1.1.0

17

changelog.md

@@ -11,2 +11,19 @@ ### key

### [1.1.0]
**fixed**
Reverts layout changes from 1.0 to fix block-layout-nesting bug.
There is a bug causing child blocks to be promoted up to ancestors when a nested layout/block is defined. It's not a common scenario, and probably hasn't been encountered in the wild yet since blocks were just introduced and haven't been documented yet. However, it's a bad bug, and would cause major problems if it surfaced.
The good news is that I know how to fix it. Bad news is that it will be time consuming and I need to make other changes before I get to that fix. Thus, in the meantime the best course of action is removing the blocks code.
### [1.0.0]
**Added**
- Templates now uses [dry] for handling layouts
- Advanced template-inheritance features, like `extends` and blocks! See [dry] documentation for details.
### [0.25.2]

@@ -13,0 +30,0 @@

2

index.js
/*!
* templates <https://github.com/jonschlinkert/templates>
*
* Copyright (c) 2015, Jon Schlinkert.
* Copyright (c) 2015-2017, Jon Schlinkert.
* Licensed under the MIT License.

@@ -6,0 +6,0 @@ */

{
"name": "templates",
"description": "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.",
"version": "0.25.3",
"version": "1.1.0",
"homepage": "https://github.com/jonschlinkert/templates",

@@ -14,5 +14,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"index.js",
"lib",
"LICENSE",
"README.md"
"lib"
],

@@ -29,11 +27,11 @@ "main": "index.js",

"array-sort": "^0.1.2",
"async-each": "^1.0.0",
"async-each": "^1.0.1",
"base": "^0.11.1",
"base-data": "^0.6.0",
"base-engines": "^0.2.0",
"base-helpers": "^0.1.1",
"base-option": "^0.8.3",
"base-helpers": "^0.2.0",
"base-option": "^0.8.4",
"base-plugins": "^0.4.13",
"base-routes": "^0.2.1",
"debug": "^2.2.0",
"base-routes": "^0.2.2",
"debug": "^2.6.0",
"deep-bind": "^0.3.0",

@@ -46,18 +44,18 @@ "define-property": "^0.2.5",

"get-value": "^2.0.6",
"get-view": "^0.1.1",
"group-array": "^0.3.0",
"has-glob": "^0.1.1",
"get-view": "^0.1.2",
"group-array": "^0.3.1",
"has-glob": "^1.0.0",
"has-value": "^0.3.1",
"inflection": "^1.10.0",
"is-valid-app": "^0.2.0",
"is-valid-app": "^0.2.1",
"layouts": "^0.11.0",
"lazy-cache": "^2.0.1",
"lazy-cache": "^2.0.2",
"match-file": "^0.2.0",
"mixin-deep": "^1.1.3",
"paginationator": "^0.1.3",
"paginationator": "^0.1.4",
"pascalcase": "^0.1.1",
"set-value": "^0.3.3",
"set-value": "^0.4.0",
"template-error": "^0.1.2",
"vinyl-item": "^0.1.0",
"vinyl-view": "^0.1.2"
"vinyl-item": "^1.0.0",
"vinyl-view": "^1.0.0"
},

@@ -67,11 +65,12 @@ "devDependencies": {

"base-test-runner": "^0.2.0",
"base-test-suite": "^0.1.12",
"base-test-suite": "^0.3.2",
"ent": "^2.2.0",
"gulp": "^3.9.1",
"gulp-eslint": "^3.0.0",
"gulp-format-md": "^0.1.9",
"gulp-istanbul": "^1.0.0",
"gulp-mocha": "^2.2.0",
"gulp-unused": "^0.1.2",
"gulp-eslint": "^3.0.1",
"gulp-format-md": "^0.1.11",
"gulp-istanbul": "^1.1.1",
"gulp-mocha": "^3.0.1",
"gulp-unused": "^0.2.1",
"helper-changelog": "^0.3.0",
"verb-generate-readme": "^0.1.21",
"remarkable": "^1.7.1",
"yargs-parser": "^2.4.0"

@@ -108,2 +107,5 @@ },

],
"helpers": [
"helper-changelog"
],
"related": {

@@ -118,2 +120,5 @@ "list": [

},
"lint": {
"reflinks": true
},
"reflinks": [

@@ -133,2 +138,3 @@ "array-sort",

"paginationator",
"route-api",
"verb",

@@ -139,7 +145,4 @@ "verb-generate-readme",

"vinyl-view"
],
"lint": {
"reflinks": false
}
]
}
}

@@ -1,2 +0,2 @@

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

@@ -37,8 +37,2 @@ > 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.

- [About](#about)
* [Related projects](#related-projects)
* [Contributing](#contributing)
* [Building docs](#building-docs)
* [Running tests](#running-tests)
* [Author](#author)
* [License](#license)

@@ -174,2 +168,6 @@ _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_

**Params**
* `options` **{Object}**
**Example**

@@ -182,6 +180,2 @@

**Params**
* `options` **{Object}**
### [.list](index.js#L154)

@@ -191,2 +185,7 @@

**Params**
* `opts` **{Object}**: List options
* `returns` **{Object}**: Returns the `list` instance for chaining.
**Example**

@@ -203,7 +202,2 @@

**Params**
* `opts` **{Object}**: List options
* `returns` **{Object}**: Returns the `list` instance for chaining.
### [.collection](index.js#L193)

@@ -236,2 +230,8 @@

**Params**
* `app` **{Object}**: Application instance
* `name` **{String}**: Optionally pass the constructor name to use.
* `returns` **{undefined}**
**Example**

@@ -247,8 +247,2 @@

**Params**
* `app` **{Object}**: Application instance
* `name` **{String}**: Optionally pass the constructor name to use.
* `returns` **{undefined}**
***

@@ -260,2 +254,8 @@

**Params**
* `exts` **{String|Array}**: String or array of file extensions.
* `fn` **{Function|Object}**: or `settings`
* `settings` **{Object}**: Optionally pass engine options as the last argument.
**Example**

@@ -275,8 +275,2 @@

**Params**
* `exts` **{String|Array}**: String or array of file extensions.
* `fn` **{Function|Object}**: or `settings`
* `settings` **{Object}**: Optionally pass engine options as the last argument.
### [.setEngine](node_modules/base-engines/index.js#L74)

@@ -286,2 +280,6 @@

**Params**
* `ext` **{String}**: The engine to set.
**Example**

@@ -295,6 +293,2 @@

**Params**
* `ext` **{String}**: The engine to set.
### [.getEngine](node_modules/base-engines/index.js#L97)

@@ -304,2 +298,6 @@

**Params**
* `ext` **{String}**: The engine to get.
**Example**

@@ -312,6 +310,2 @@

**Params**
* `ext` **{String}**: The engine to get.
***

@@ -323,2 +317,7 @@

**Params**
* `name` **{String}**: Helper name
* `fn` **{Function}**: Helper function.
**Example**

@@ -332,7 +331,2 @@

**Params**
* `name` **{String}**: Helper name
* `fn` **{Function}**: Helper function.
### [.helpers](node_modules/base-helpers/index.js#L67)

@@ -342,2 +336,6 @@

**Params**
* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.
**Example**

@@ -353,9 +351,10 @@

**Params**
### [.asyncHelper](node_modules/base-helpers/index.js#L89)
* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.
Register an async helper.
### [.asyncHelper](node_modules/base-helpers/index.js#L86)
**Params**
Register an async helper.
* `name` **{String}**: Helper name.
* `fn` **{Function}**: Helper function

@@ -370,10 +369,9 @@ **Example**

**Params**
### [.asyncHelpers](node_modules/base-helpers/index.js#L110)
* `name` **{String}**: Helper name.
* `fn` **{Function}**: Helper function
Register multiple async template helpers.
### [.asyncHelpers](node_modules/base-helpers/index.js#L107)
**Params**
Register multiple async template helpers.
* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.

@@ -390,9 +388,10 @@ **Example**

**Params**
### [.getHelper](node_modules/base-helpers/index.js#L130)
* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.
Get a previously registered helper.
### [.getHelper](node_modules/base-helpers/index.js#L124)
**Params**
Get a previously registered helper.
* `name` **{String}**: Helper name
* `returns` **{Function}**: Returns the registered helper function.

@@ -405,2 +404,6 @@ **Example**

### [.getAsyncHelper](node_modules/base-helpers/index.js#L147)
Get a previously registered async helper.
**Params**

@@ -411,6 +414,2 @@

### [.getAsyncHelper](node_modules/base-helpers/index.js#L141)
Get a previously registered async helper.
**Example**

@@ -422,10 +421,10 @@

**Params**
### [.hasHelper](node_modules/base-helpers/index.js#L166)
* `name` **{String}**: Helper name
* `returns` **{Function}**: Returns the registered helper function.
Return true if sync helper `name` is registered.
### [.hasHelper](node_modules/base-helpers/index.js#L160)
**Params**
Return true if sync helper `name` is registered.
* `name` **{String}**: sync helper name
* `returns` **{Boolean}**: Returns true if the sync helper is registered

@@ -440,10 +439,10 @@ **Example**

**Params**
### [.hasAsyncHelper](node_modules/base-helpers/index.js#L184)
* `name` **{String}**: sync helper name
* `returns` **{Boolean}**: Returns true if the sync helper is registered
Return true if async helper `name` is registered.
### [.hasAsyncHelper](node_modules/base-helpers/index.js#L178)
**Params**
Return true if async helper `name` is registered.
* `name` **{String}**: Async helper name
* `returns` **{Boolean}**: Returns true if the async helper is registered

@@ -458,10 +457,9 @@ **Example**

**Params**
### [.helperGroup](node_modules/base-helpers/index.js#L207)
* `name` **{String}**: Async helper name
* `returns` **{Boolean}**: Returns true if the async helper is registered
Register a namespaced helper group.
### [.helperGroup](node_modules/base-helpers/index.js#L201)
**Params**
Register a namespaced helper group.
* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.

@@ -482,6 +480,2 @@ **Example**

**Params**
* `helpers` **{Object|Array}**: Object, array of objects, or glob patterns.
### Built-in helpers

@@ -499,2 +493,6 @@

**Params**
* `view` **{Object}**
**Example**

@@ -509,6 +507,2 @@

**Params**
* `view` **{Object}**
### [.compile](node_modules/vinyl-view/index.js#L57)

@@ -518,2 +512,7 @@

**Params**
* `locals` **{Object}**: Optionally pass locals to the engine.
* `returns` **{Object}** `View`: instance, for chaining.
**Example**

@@ -528,2 +527,6 @@

### [.renderSync](node_modules/vinyl-view/index.js#L75)
Synchronously render templates in `view.content`.
**Params**

@@ -534,6 +537,2 @@

### [.renderSync](node_modules/vinyl-view/index.js#L75)
Synchronously render templates in `view.content`.
**Example**

@@ -547,7 +546,2 @@

**Params**
* `locals` **{Object}**: Optionally pass locals to the engine.
* `returns` **{Object}** `View`: instance, for chaining.
### [.render](node_modules/vinyl-view/index.js#L101)

@@ -557,2 +551,6 @@

**Params**
* `locals` **{Object}**: Context to use for rendering templates.
**Example**

@@ -566,6 +564,2 @@

**Params**
* `locals` **{Object}**: Context to use for rendering templates.
### [.context](node_modules/vinyl-view/index.js#L132)

@@ -579,2 +573,7 @@

**Params**
* `locals` **{Object}**: Optionally pass a locals object to merge onto the context.
* `returns` **{Object}**: Returns the context object.
**Example**

@@ -589,7 +588,2 @@

**Params**
* `locals` **{Object}**: Optionally pass a locals object to merge onto the context.
* `returns` **{Object}**: Returns the context object.
### [.isType](node_modules/vinyl-view/index.js#L148)

@@ -599,2 +593,6 @@

**Params**
* `type` **{String}**: (`renderable`, `partial`, `layout`)
**Example**

@@ -607,6 +605,2 @@

**Params**
* `type` **{String}**: (`renderable`, `partial`, `layout`)
### [.View.context](node_modules/vinyl-view/index.js#L248)

@@ -616,2 +610,7 @@

**Params**
* `locals` **{Object}**
* `returns` **{Object}**
**Example**

@@ -627,7 +626,2 @@

**Params**
* `locals` **{Object}**
* `returns` **{Object}**
### [.data](lib/plugins/context.js#L42)

@@ -637,2 +631,8 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
**Example**

@@ -647,8 +647,2 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
### [.context](lib/plugins/context.js#L62)

@@ -701,6 +695,10 @@

### [Item](node_modules/vinyl-item/index.js#L28)
### [Item](node_modules/vinyl-item/index.js#L32)
Create an instance of `Item`. Optionally pass a default object to use. See [vinyl](https://github.com/gulpjs/vinyl) docs for API details and additional documentation.
**Params**
* `item` **{Object}**
**Example**

@@ -715,8 +713,4 @@

**Params**
### [.content](node_modules/vinyl-item/index.js#L215)
* `item` **{Object}**
### [.content](node_modules/vinyl-item/index.js#L184)
Normalize the `content` and `contents` properties on `item`. This is done to ensure compatibility with the vinyl convention of using `contents` as a Buffer, as well as the assemble convention of using `content` as a string. We will eventually deprecate the `content` property.

@@ -732,3 +726,3 @@

### [.engine](node_modules/vinyl-item/index.js#L206)
### [.engine](node_modules/vinyl-item/index.js#L237)

@@ -749,2 +743,8 @@ Getter/setter to resolve the name of the `engine` to use for rendering.

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
**Example**

@@ -759,8 +759,2 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
### [.context](lib/plugins/context.js#L62)

@@ -817,2 +811,6 @@

**Params**
* `options` **{Object}**
**Example**

@@ -825,6 +823,2 @@

**Params**
* `options` **{Object}**
### [.addView](lib/views.js#L132)

@@ -834,2 +828,9 @@

**Params**
* `key` **{String|Object}**: View key or object
* `value` **{Object}**: If key is a string, value is the view object.
* `next` **{Function}**: Optionally pass a callback function as the last argument to load the view asynchronously. This will also ensure that `.onLoad` middleware is executed asynchronously.
* `returns` **{Object}**: returns the `view` instance.
**Example**

@@ -847,2 +848,6 @@

### [.setView](lib/views.js#L174)
Set a view on the collection. This is identical to [addView](#addView) except `setView` does not emit an event for each view.
**Params**

@@ -852,9 +857,4 @@

* `value` **{Object}**: If key is a string, value is the view object.
* `next` **{Function}**: Optionally pass a callback function as the last argument to load the view asynchronously. This will also ensure that `.onLoad` middleware is executed asynchronously.
* `returns` **{Object}**: returns the `view` instance.
### [.setView](lib/views.js#L174)
Set a view on the collection. This is identical to [addView](#addView) except `setView` does not emit an event for each view.
**Example**

@@ -866,8 +866,2 @@

**Params**
* `key` **{String|Object}**: View key or object
* `value` **{Object}**: If key is a string, value is the view object.
* `returns` **{Object}**: returns the `view` instance.
### [.getView](lib/views.js#L191)

@@ -877,2 +871,8 @@

**Params**
* `key` **{String}**: Key of the view to get.
* `fn` **{Function}**: Optionally pass a function to modify the key.
* `returns` **{Object}**
**Example**

@@ -884,8 +884,2 @@

**Params**
* `key` **{String}**: Key of the view to get.
* `fn` **{Function}**: Optionally pass a function to modify the key.
* `returns` **{Object}**
### [.deleteView](lib/views.js#L226)

@@ -895,2 +889,7 @@

**Params**
* `key` **{String}**
* `returns` **{Object}**: Returns the instance for chaining
**Example**

@@ -902,7 +901,2 @@

**Params**
* `key` **{String}**
* `returns` **{Object}**: Returns the instance for chaining
### [.addViews](lib/views.js#L250)

@@ -912,2 +906,7 @@

**Params**
* `views` **{Object|Array}**
* `returns` **{Object}**: returns the `collection` object
**Example**

@@ -923,7 +922,2 @@

**Params**
* `views` **{Object|Array}**
* `returns` **{Object}**: returns the `collection` object
### [.addList](lib/views.js#L282)

@@ -933,2 +927,7 @@

**Params**
* `list` **{Array}**
* `returns` **{Object}**: returns the `views` instance
**Example**

@@ -944,7 +943,2 @@

**Params**
* `list` **{Array}**
* `returns` **{Object}**: returns the `views` instance
### [.groupBy](lib/views.js#L319)

@@ -954,2 +948,4 @@

* `returns` **{Object}**: Returns an object of grouped views.
**Example**

@@ -963,4 +959,2 @@

* `returns` **{Object}**: Returns an object of grouped views.
### [.isType](lib/views.js#L349)

@@ -970,2 +964,6 @@

**Params**
* `type` **{String}**: (`renderable`, `partial`, `layout`)
**Example**

@@ -977,6 +975,2 @@

**Params**
* `type` **{String}**: (`renderable`, `partial`, `layout`)
### [.viewTypes](lib/views.js#L396)

@@ -990,2 +984,8 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
**Example**

@@ -1000,8 +1000,2 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
### [.context](lib/plugins/context.js#L62)

@@ -1054,2 +1048,8 @@

**Params**
* `name` **{String}**: The name/key of the view to find
* `colleciton` **{String}**: Optionally pass a collection name (e.g. pages)
* `returns` **{Object|undefined}**: Returns the view if found, or `undefined` if not.
**Example**

@@ -1064,8 +1064,2 @@

**Params**
* `name` **{String}**: The name/key of the view to find
* `colleciton` **{String}**: Optionally pass a collection name (e.g. pages)
* `returns` **{Object|undefined}**: Returns the view if found, or `undefined` if not.
### [.getView](lib/plugins/lookup.js#L64)

@@ -1075,2 +1069,9 @@

**Params**
* `collection` **{String}**: Collection name, e.g. `pages`
* `key` **{String}**: Template name
* `fn` **{Function}**: Optionally pass a `renameKey` function
* `returns` **{Object}**
**Example**

@@ -1087,13 +1088,11 @@

### [.getViews](lib/plugins/lookup.js#L103)
Get all views from a `collection` using the collection's singular or plural name.
**Params**
* `collection` **{String}**: Collection name, e.g. `pages`
* `key` **{String}**: Template name
* `fn` **{Function}**: Optionally pass a `renameKey` function
* `name` **{String}**: The collection name, e.g. `pages` or `page`
* `returns` **{Object}**
### [.getViews](lib/plugins/lookup.js#L103)
Get all views from a `collection` using the collection's singular or plural name.
**Example**

@@ -1109,7 +1108,2 @@

**Params**
* `name` **{String}**: The collection name, e.g. `pages` or `page`
* `returns` **{Object}**
***

@@ -1125,2 +1119,6 @@

**Params**
* `options` **{Object}**
**Example**

@@ -1133,6 +1131,2 @@

**Params**
* `options` **{Object}**
### [.addItem](lib/collection.js#L93)

@@ -1142,8 +1136,2 @@

**Example**
```js
collection.addItem('foo', {content: 'bar'});
```
**Params**

@@ -1159,12 +1147,12 @@

### [.setItem](lib/collection.js#L118)
Identical to `.addItem`, except the collection instance is returned instead of the item, to allow chaining.
**Example**
```js
collection.setItem('foo', {content: 'bar'});
collection.addItem('foo', {content: 'bar'});
```
### [.setItem](lib/collection.js#L118)
Identical to `.addItem`, except the collection instance is returned instead of the item, to allow chaining.
**Params**

@@ -1180,2 +1168,8 @@

**Example**
```js
collection.setItem('foo', {content: 'bar'});
```
### [.getItem](lib/collection.js#L134)

@@ -1185,2 +1179,7 @@

**Params**
* `key` **{String}**: Key of the item to get.
* `returns` **{Object}**
**Example**

@@ -1192,7 +1191,2 @@

**Params**
* `key` **{String}**: Key of the item to get.
* `returns` **{Object}**
### [.deleteItem](lib/collection.js#L149)

@@ -1202,2 +1196,7 @@

**Params**
* `key` **{String}**
* `returns` **{Object}**: Returns the instance for chaining
**Example**

@@ -1209,7 +1208,2 @@

**Params**
* `key` **{String}**
* `returns` **{Object}**: Returns the instance for chaining
### [.addItems](lib/collection.js#L172)

@@ -1219,2 +1213,7 @@

**Params**
* `items` **{Object|Array}**
* `returns` **{Object}**: returns the instance for chaining
**Example**

@@ -1230,7 +1229,2 @@

**Params**
* `items` **{Object|Array}**
* `returns` **{Object}**: returns the instance for chaining
### [.addList](lib/collection.js#L196)

@@ -1240,2 +1234,8 @@

**Params**
* `items` **{Array}**: or an instance of `List`
* `fn` **{Function}**: Optional sync callback function that is called on each item.
* `returns` **{Object}**: returns the Collection instance for chaining
**Example**

@@ -1251,8 +1251,2 @@

**Params**
* `items` **{Array}**: or an instance of `List`
* `fn` **{Function}**: Optional sync callback function that is called on each item.
* `returns` **{Object}**: returns the Collection instance for chaining
### [.data](lib/plugins/context.js#L42)

@@ -1262,2 +1256,8 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
**Example**

@@ -1272,8 +1272,2 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
### [.context](lib/plugins/context.js#L62)

@@ -1330,2 +1324,6 @@

**Params**
* `options` **{Object}**
**Example**

@@ -1338,6 +1336,2 @@

**Params**
* `options` **{Object}**
### [.addItem](lib/list.js#L108)

@@ -1347,2 +1341,8 @@

**Params**
* `key` **{String|Object}**: Item key or object
* `value` **{Object}**: If key is a string, value is the item object.
* `returns` **{Object}**: returns the `item` instance.
**Example**

@@ -1354,8 +1354,2 @@

**Params**
* `key` **{String|Object}**: Item key or object
* `value` **{Object}**: If key is a string, value is the item object.
* `returns` **{Object}**: returns the `item` instance.
### [.setItem](lib/list.js#L146)

@@ -1365,2 +1359,8 @@

**Params**
* `key` **{String}**
* `value` **{Object}**
* `returns` **{Object}**: Returns the instance of `List` to support chaining.
**Example**

@@ -1373,8 +1373,2 @@

**Params**
* `key` **{String}**
* `value` **{Object}**
* `returns` **{Object}**: Returns the instance of `List` to support chaining.
### [.addItems](lib/list.js#L166)

@@ -1384,2 +1378,7 @@

**Params**
* `items` **{Object|Array}**
* `returns` **{Object}**: returns the instance for chaining
**Example**

@@ -1395,7 +1394,2 @@

**Params**
* `items` **{Object|Array}**
* `returns` **{Object}**: returns the instance for chaining
### [.addList](lib/list.js#L195)

@@ -1405,2 +1399,8 @@

**Params**
* `items` **{Array}**: or an instance of `List`
* `fn` **{Function}**: Optional sync callback function that is called on each item.
* `returns` **{Object}**: returns the List instance for chaining
**Example**

@@ -1414,8 +1414,2 @@

**Params**
* `items` **{Array}**: or an instance of `List`
* `fn` **{Function}**: Optional sync callback function that is called on each item.
* `returns` **{Object}**: returns the List instance for chaining
### [.hasItem](lib/list.js#L232)

@@ -1425,2 +1419,7 @@

**Params**
* `key` **{String}**
* `returns` **{Object}**
**Example**

@@ -1434,2 +1433,6 @@

### [.getIndex](lib/list.js#L248)
Get a the index of a specific item from the list by `key`.
**Params**

@@ -1440,6 +1443,2 @@

### [.getIndex](lib/list.js#L248)
Get a the index of a specific item from the list by `key`.
**Example**

@@ -1452,11 +1451,11 @@

### [.getItem](lib/list.js#L292)
Get a specific item from the list by `key`.
**Params**
* `key` **{String}**
* `key` **{String}**: The item name/key.
* `returns` **{Object}**
### [.getItem](lib/list.js#L292)
Get a specific item from the list by `key`.
**Example**

@@ -1469,11 +1468,11 @@

### [.getView](lib/list.js#L311)
Proxy for `getItem`
**Params**
* `key` **{String}**: The item name/key.
* `key` **{String}**: Pass the key of the `item` to get.
* `returns` **{Object}**
### [.getView](lib/list.js#L311)
Proxy for `getItem`
**Example**

@@ -1486,7 +1485,2 @@

**Params**
* `key` **{String}**: Pass the key of the `item` to get.
* `returns` **{Object}**
### [.deleteItem](lib/list.js#L325)

@@ -1496,2 +1490,6 @@

**Params**
* `key` **{Object|String}**: Pass an `item` instance (object) or `item.key` (string).
**Example**

@@ -1503,6 +1501,2 @@

**Params**
* `key` **{Object|String}**: Pass an `item` instance (object) or `item.key` (string).
### [.extendItem](lib/list.js#L344)

@@ -1523,2 +1517,4 @@

* `returns` **{Object}**: Returns the grouped items.
**Example**

@@ -1532,4 +1528,2 @@

* `returns` **{Object}**: Returns the grouped items.
### [.sortBy](lib/list.js#L389)

@@ -1539,2 +1533,4 @@

* `returns` **{Object}**: Returns a new `List` instance with sorted items.
**Example**

@@ -1549,4 +1545,2 @@

* `returns` **{Object}**: Returns a new `List` instance with sorted items.
### [.paginate](lib/list.js#L437)

@@ -1556,2 +1550,4 @@

* `returns` **{Object}**: Returns the paginated items.
**Example**

@@ -1564,4 +1560,2 @@

* `returns` **{Object}**: Returns the paginated items.
### [.data](lib/plugins/context.js#L42)

@@ -1571,2 +1565,8 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
**Example**

@@ -1581,8 +1581,2 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
### [.context](lib/plugins/context.js#L62)

@@ -1639,2 +1633,6 @@

**Params**
* `options` **{Object}**
**Example**

@@ -1648,6 +1646,2 @@

**Params**
* `options` **{Object}**
***

@@ -1659,2 +1653,8 @@

**Params**
* `name` **{String}**: The name/key of the view to find
* `colleciton` **{String}**: Optionally pass a collection name (e.g. pages)
* `returns` **{Object|undefined}**: Returns the view if found, or `undefined` if not.
**Example**

@@ -1669,8 +1669,2 @@

**Params**
* `name` **{String}**: The name/key of the view to find
* `colleciton` **{String}**: Optionally pass a collection name (e.g. pages)
* `returns` **{Object|undefined}**: Returns the view if found, or `undefined` if not.
### [.getView](lib/plugins/lookup.js#L64)

@@ -1680,2 +1674,9 @@

**Params**
* `collection` **{String}**: Collection name, e.g. `pages`
* `key` **{String}**: Template name
* `fn` **{Function}**: Optionally pass a `renameKey` function
* `returns` **{Object}**
**Example**

@@ -1692,13 +1693,11 @@

### [.getViews](lib/plugins/lookup.js#L103)
Get all views from a `collection` using the collection's singular or plural name.
**Params**
* `collection` **{String}**: Collection name, e.g. `pages`
* `key` **{String}**: Template name
* `fn` **{Function}**: Optionally pass a `renameKey` function
* `name` **{String}**: The collection name, e.g. `pages` or `page`
* `returns` **{Object}**
### [.getViews](lib/plugins/lookup.js#L103)
Get all views from a `collection` using the collection's singular or plural name.
**Example**

@@ -1714,7 +1713,2 @@

**Params**
* `name` **{String}**: The collection name, e.g. `pages` or `page`
* `returns` **{Object}**
***

@@ -1726,2 +1720,9 @@

**Params**
* `view` **{Object|String}**: View object.
* `locals` **{Object}**
* `isAsync` **{Boolean}**: Load async helpers
* `returns` **{Object}**: View object with compiled `view.fn` property.
**Example**

@@ -1741,2 +1742,6 @@

### [.compileAsync](lib/plugins/render.js#L173)
Asynchronously compile `content` with the given `locals` and callback. _(fwiw, this method name uses the unconventional "*Async" nomenclature to allow us to preserve the synchronous behavior of the `view.compile` method as well as the name)_.
**Params**

@@ -1746,9 +1751,5 @@

* `locals` **{Object}**
* `isAsync` **{Boolean}**: Load async helpers
* `returns` **{Object}**: View object with compiled `view.fn` property.
* `isAsync` **{Boolean}**: Pass true to load helpers as async (mostly used internally)
* `callback` **{Function}**: function that exposes `err` and the `view` object with compiled `view.fn` property
### [.compileAsync](lib/plugins/render.js#L173)
Asynchronously compile `content` with the given `locals` and callback. _(fwiw, this method name uses the unconventional "*Async" nomenclature to allow us to preserve the synchronous behavior of the `view.compile` method as well as the name)_.
**Example**

@@ -1763,9 +1764,2 @@

**Params**
* `view` **{Object|String}**: View object.
* `locals` **{Object}**
* `isAsync` **{Boolean}**: Pass true to load helpers as async (mostly used internally)
* `callback` **{Function}**: function that exposes `err` and the `view` object with compiled `view.fn` property
### [.render](lib/plugins/render.js#L264)

@@ -1775,2 +1769,8 @@

**Params**
* `view` **{Object|String}**: Instance of `View`
* `locals` **{Object}**: Locals to pass to template engine.
* `callback` **{Function}**
**Example**

@@ -1785,8 +1785,2 @@

**Params**
* `view` **{Object|String}**: Instance of `View`
* `locals` **{Object}**: Locals to pass to template engine.
* `callback` **{Function}**
***

@@ -1798,2 +1792,8 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
**Example**

@@ -1808,8 +1808,2 @@

**Params**
* `key` **{String|Object}**: Pass a key-value pair or an object to set.
* `val` **{any}**: Any value when a key-value pair is passed. This can also be options if a glob pattern is passed as the first value.
* `returns` **{Object}**: Returns an instance of `Templates` for chaining.
### [.context](lib/plugins/context.js#L62)

@@ -1873,8 +1867,2 @@

**Example**
```js
app.handle('customMethod', file, callback);
```
**Params**

@@ -1887,12 +1875,12 @@

### [.handleOnce](node_modules/base-routes/index.js#L109)
Run the given middleware handler only if the file has not already been handled by `method`.
**Example**
```js
app.handleOnce('onLoad', file, callback);
app.handle('customMethod', file, callback);
```
### [.handleOnce](node_modules/base-routes/index.js#L109)
Run the given middleware handler only if the file has not already been handled by `method`.
**Params**

@@ -1904,2 +1892,8 @@

**Example**
```js
app.handleOnce('onLoad', file, callback);
```
### [.route](node_modules/base-routes/index.js#L193)

@@ -1909,2 +1903,7 @@

**Params**
* `path` **{String}**
* `returns` **{Object}**: Returns the instance for chaining.
**Example**

@@ -1923,11 +1922,12 @@

### [.param](node_modules/base-routes/index.js#L220)
Add callback triggers to route parameters, where `name` is the name of the parameter and `fn` is the callback function.
**Params**
* `path` **{String}**
* `name` **{String}**
* `fn` **{Function}**
* `returns` **{Object}**: Returns the instance for chaining.
### [.param](node_modules/base-routes/index.js#L220)
Add callback triggers to route parameters, where `name` is the name of the parameter and `fn` is the callback function.
**Example**

@@ -1947,8 +1947,2 @@

**Params**
* `name` **{String}**
* `fn` **{Function}**
* `returns` **{Object}**: Returns the instance for chaining.
### [.all](node_modules/base-routes/index.js#L243)

@@ -1958,2 +1952,8 @@

**Params**
* `path` **{String}**
* `callback` **{Function}**
* `returns` **{Object}** `this`: for chaining
**Example**

@@ -1968,8 +1968,2 @@

**Params**
* `path` **{String}**
* `callback` **{Function}**
* `returns` **{Object}** `this`: for chaining
### [.handler](node_modules/base-routes/index.js#L265)

@@ -1979,2 +1973,7 @@

**Params**
* `method` **{String}**: Name of the handler method to define.
* `returns` **{Object}**: Returns the instance for chaining
**Example**

@@ -1988,11 +1987,11 @@

### [.handlers](node_modules/base-routes/index.js#L284)
Add one or more router handler methods to the instance.
**Params**
* `method` **{String}**: Name of the handler method to define.
* `methods` **{Array|String}**: One or more method names to define.
* `returns` **{Object}**: Returns the instance for chaining
### [.handlers](node_modules/base-routes/index.js#L284)
Add one or more router handler methods to the instance.
**Example**

@@ -2006,7 +2005,2 @@

**Params**
* `methods` **{Array|String}**: One or more method names to define.
* `returns` **{Object}**: Returns the instance for chaining
***

@@ -2018,2 +2012,7 @@

**Params**
* `val` **{Object}**: The value to test.
* `returns` **{Boolean}**
**Example**

@@ -2032,2 +2031,6 @@

### [.isCollection](lib/plugins/is.js#L55)
Static method that returns true if the given value is a templates `Collection` instance.
**Params**

@@ -2038,6 +2041,2 @@

### [.isCollection](lib/plugins/is.js#L55)
Static method that returns true if the given value is a templates `Collection` instance.
**Example**

@@ -2054,2 +2053,6 @@

### [.isViews](lib/plugins/is.js#L77)
Static method that returns true if the given value is a templates `Views` instance.
**Params**

@@ -2060,6 +2063,2 @@

### [.isViews](lib/plugins/is.js#L77)
Static method that returns true if the given value is a templates `Views` instance.
**Example**

@@ -2076,2 +2075,6 @@

### [.isList](lib/plugins/is.js#L100)
Static method that returns true if the given value is a templates `List` instance.
**Params**

@@ -2082,6 +2085,2 @@

### [.isList](lib/plugins/is.js#L100)
Static method that returns true if the given value is a templates `List` instance.
**Example**

@@ -2099,2 +2098,6 @@

### [.isGroup](lib/plugins/is.js#L123)
Static method that returns true if the given value is a templates `Group` instance.
**Params**

@@ -2105,6 +2108,2 @@

### [.isGroup](lib/plugins/is.js#L123)
Static method that returns true if the given value is a templates `Group` instance.
**Example**

@@ -2122,2 +2121,6 @@

### [.isView](lib/plugins/is.js#L148)
Static method that returns true if the given value is a templates `View` instance.
**Params**

@@ -2128,6 +2131,2 @@

### [.isView](lib/plugins/is.js#L148)
Static method that returns true if the given value is a templates `View` instance.
**Example**

@@ -2147,2 +2146,6 @@

### [.isItem](lib/plugins/is.js#L173)
Static method that returns true if the given value is a templates `Item` instance.
**Params**

@@ -2153,6 +2156,2 @@

### [.isItem](lib/plugins/is.js#L173)
Static method that returns true if the given value is a templates `Item` instance.
**Example**

@@ -2172,2 +2171,6 @@

### [.isVinyl](lib/plugins/is.js#L200)
Static method that returns true if the given value is a vinyl `File` instance.
**Params**

@@ -2178,6 +2181,2 @@

### [.isVinyl](lib/plugins/is.js#L200)
Static method that returns true if the given value is a vinyl `File` instance.
**Example**

@@ -2199,7 +2198,2 @@

**Params**
* `val` **{Object}**: The value to test.
* `returns` **{Boolean}**
***

@@ -2241,2 +2235,19 @@

### [1.1.0](https://github.com/jonschlinkert/templates/compare/1.0.0...1.1.0)
**fixed**
Reverts layout changes from 1.0 to fix block-layout-nesting bug.
There is a bug causing child blocks to be promoted up to ancestors when a nested layout/block is defined. It's not a common scenario, and probably hasn't been encountered in the wild yet since blocks were just introduced and haven't been documented yet. However, it's a bad bug, and would cause major problems if it surfaced.
The good news is that I know how to fix it. Bad news is that it will be time consuming and I need to make other changes before I get to that fix. Thus, in the meantime the best course of action is removing the blocks code.
### [1.0.0](https://github.com/jonschlinkert/templates/compare/0.25.2...1.0.0)
**Added**
* Templates now uses [dry](https://github.com/jonschlinkert/dry) for handling layouts
* Advanced template-inheritance features, like `extends` and blocks! See [dry](https://github.com/jonschlinkert/dry) documentation for details.
### [0.25.2](https://github.com/jonschlinkert/templates/compare/0.25.1...0.25.2)

@@ -2412,10 +2423,18 @@

### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 715 | [jonschlinkert](https://github.com/jonschlinkert) |
| 105 | [doowb](https://github.com/doowb) |
| 1 | [chronzerg](https://github.com/chronzerg) |
### Building docs
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
_(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 and API documentation with [verb](https://github.com/verbose/verb):
To generate the readme, run the following command:
```sh
$ npm install -g verb verb-generate-readme && verb
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

@@ -2428,3 +2447,3 @@

```sh
$ npm install -d && npm test
$ npm install && npm test
```

@@ -2437,7 +2456,7 @@

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](LICENSE).

@@ -2447,2 +2466,2 @@

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 10, 2016._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.1, on January 25, 2017._

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc