<commit_before># load-templates [![NPM version](https://badge.fury.io/js/load-templates.svg)](http://badge.fury.io/js/load-templates)  [![Build Status](https://travis-ci.org/jonschlinkert/load-templates.svg)](https://travis-ci.org/jonschlinkert/load-templates)

> Load templates.

## Install

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

```sh
$ npm i load-templates --save
```

## Usage

In addition to what's shown in the below examples, if a glob pattern or valid filepath is passed, a `stat` object will be added to the `file` object as well.

```js
var loader = require('load-templates');
// optionally pass an object to use for caching the views
var cache = {};
var views = loader(cache);

// object of views
views({
  a: {path: 'a'},
  b: {path: 'b'},
  c: {path: 'c'}
});

// key-value pairs
views('d', {path: 'd'});
views('e', {path: 'e'});
views('f', {path: 'f'});

// glob pattern or file path, string or array
views('views/*.js'); // g, h, i
```

Results in:

```js
{
  a: {path: 'a'},
  b: {path: 'b'},
  c: {path: 'c'},
  d: {path: 'd'},
  e: {path: 'e'},
  f: {path: 'f'},
  g: {path: 'g'},
  h: {path: 'h'},
  i: {path: 'i'},
  j: {path: 'j'}
}
```

## Options

### options.renameKey

Rename the key of each `file` object.

Type: `Function`

Default: `noop` Full filepath or whatever key is passed.

### glob options

All options are also passed to [globby](https://github.com/sindresorhus/globby).

## Related projects

* [assemble](http://assemble.io): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](http://assemble.io)
* [templates](https://github.com/jonschlinkert/templates): System for creating and managing template collections, and rendering templates with any node.js template engine.… [more](https://github.com/jonschlinkert/templates)
* [verb](https://github.com/verbose/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb)

## Running tests

Install dev dependencies:

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

## Coverage summary

As of version 0.9.0

```
Statements   : 100% (81/81)
Branches     : 100% (44/44)
Functions    : 100% (13/13)
Lines        : 100% (79/79)
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/load-templates/issues/new).

## Author

**<NAME>**
<commit_msg>0.9.1 docs<commit_after># load-templates [![NPM version](https://badge.fury.io/js/load-templates.svg)](http://badge.fury.io/js/load-templates)  [![Build Status](https://travis-ci.org/jonschlinkert/load-templates.svg)](https://travis-ci.org/jonschlinkert/load-templates)

> Load templates.

## Install

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

```sh
$ npm i load-templates --save
```

## Usage

In addition to what's shown in the below examples, if a glob pattern or valid filepath is passed, a `stat` object will be added to the `file` object as well.

```js
var loader = require('load-templates');
// optionally pass an object to use for caching the views
var cache = {};
var views = loader(cache);

// object of views
views({
  a: {path: 'a'},
  b: {path: 'b'},
  c: {path: 'c'}
});

// key-value pairs
views('d', {path: 'd'});
views('e', {path: 'e'});
views('f', {path: 'f'});

// glob pattern or file path, string or array
views('views/*.js'); // g, h, i
```

Results in:

```js
{
  a: {path: 'a'},
  b: {path: 'b'},
  c: {path: 'c'},
  d: {path: 'd'},
  e: {path: 'e'},
  f: {path: 'f'},
  g: {path: 'g'},
  h: {path: 'h'},
  i: {path: 'i'},
  j: {path: 'j'}
}
```

## Options

### options.renameKey

Rename the key of each `file` object.

Type: `Function`

Default: `noop` Full filepath or whatever key is passed.

### glob options

All options are also passed to [globby](https://github.com/sindresorhus/globby).

## Related projects

* [assemble](http://assemble.io): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](http://assemble.io)
* [templates](https://github.com/jonschlinkert/templates): System for creating and managing template collections, and rendering templates with any node.js template engine.… [more](https://github.com/jonschlinkert/templates)
* [verb](https://github.com/verbose/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb)

## Running tests

Install dev dependencies:

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

## Coverage summary

As of version 0.9.1

```
Statements   : 100% (81/81)
Branches     : 100% (44/44)
Functions    : 100% (13/13)
Lines        : 100% (79/79)
```

## Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/load-templates/issues/new).

## Author

**<NAME>**

{'fraction_non_alphanumeric': 0.18307286381165008, 'fraction_numerical': 0.013598538664501725, 'mean_word_length': 3.977777777777778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 20, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5945873', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1715, 'n_words': 533}