<commit_before># koa-views

[![NPM version][npm-image]][npm-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]

Template rendering middleware for koa, supporting [many](https://github.com/tj/consolidate.js#supported-template-engines) template engines.

## Installation

```
$ npm install koa-views
```

## Example

```js
// Must be used before any router is used
app.use(views('views', {
  map: {
    html: underscore
  }
}));

app.use(function* (next) {
  this.locals = {
    session: this.session,
    title: 'app'
  };

  yield this.render('user', {
    user: 'John'
  });
});
```

For more examples take a look at the [tests](./test/index.js)

## API

#### `views([path, opts])`

* `path (__dirname)`: __dirname + where your views are located
* `opts`: these options go straight to [co-views](https://github.com/visionmedia/co-views).

## Debug

```bash
$ DEBUG=koa-views node --harmony-generators server.js
```

## License

[MIT](./license)

[npm-image]: https://img.shields.io/npm/v/koa-views.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-views
[david-image]: http://img.shields.io/david/queckezz/koa-views.svg?style=flat-square
[david-url]: https://david-dm.org/queckezz/koa-views
[license-image]: http://img.shields.io/npm/l/koa-views.svg?style=flat-square
[license-url]: ./license<commit_msg>readme: better debug section<commit_after># koa-views

[![NPM version][npm-image]][npm-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]

Template rendering middleware for koa, supporting [many](https://github.com/tj/consolidate.js#supported-template-engines) template engines.

## Installation

```
$ npm install koa-views
```

## Example

```js
// Must be used before any router is used
app.use(views('views', {
  map: {
    html: underscore
  }
}));

app.use(function* (next) {
  this.locals = {
    session: this.session,
    title: 'app'
  };

  yield this.render('user', {
    user: 'John'
  });
});
```

For more examples take a look at the [tests](./test/index.js)

## API

#### `views([path, opts])`

* `path (__dirname)`: __dirname + where your views are located
* `opts`: these options go straight to [co-views](https://github.com/visionmedia/co-views).

## Debug

Set the `DEBUG` environment variable to `koa-views` when starting your server.

```bash
$ DEBUG=koa-views
```

## License

[MIT](./license)

[npm-image]: https://img.shields.io/npm/v/koa-views.svg?style=flat-square
[npm-url]: https://npmjs.org/package/koa-views
[david-image]: http://img.shields.io/david/queckezz/koa-views.svg?style=flat-square
[david-url]: https://david-dm.org/queckezz/koa-views
[license-image]: http://img.shields.io/npm/l/koa-views.svg?style=flat-square
[license-url]: ./license
{'fraction_non_alphanumeric': 0.19467434328895286, 'fraction_numerical': 0.0, 'mean_word_length': 4.295238095238095, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, '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': '3124896', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1006, 'n_words': 194}