https://github.com/ladjs/koa-views-render
Simple render(page, locals) middleware for Koa and Lad (uses koa-views)
https://github.com/ladjs/koa-views-render
consolidate ejs engine koa locals middleware nunjucks pug render template templating view views
Last synced: 4 months ago
JSON representation
Simple render(page, locals) middleware for Koa and Lad (uses koa-views)
- Host: GitHub
- URL: https://github.com/ladjs/koa-views-render
- Owner: ladjs
- License: mit
- Created: 2017-09-09T19:28:59.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-06-09T01:08:30.000Z (over 1 year ago)
- Last Synced: 2024-10-01T14:34:53.815Z (5 months ago)
- Topics: consolidate, ejs, engine, koa, locals, middleware, nunjucks, pug, render, template, templating, view, views
- Language: JavaScript
- Homepage: https://lad.js.org
- Size: 42 KB
- Stars: 4
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# koa-views-render
[](https://github.com/sindresorhus/xo)
[](https://github.com/prettier/prettier)
[](https://lass.js.org)
[](<>)> Simple `render(page, locals)` middleware for [Koa][] and [Lad][] (uses [koa-views][]).
## Table of Contents
* [Install](#install)
* [Usage](#usage)
* [Contributors](#contributors)
* [License](#license)## Install
[npm][]:
```sh
npm install koa-views-render
```[yarn][]:
```sh
yarn add koa-views-render
```## Usage
> This is a simple middleware that simply passes down to `ctx.render` the `page` and `locals` arguments you provide.
>
> For example `render(page,locals)` will get passed to `ctx.render(page,locals)`. See [koa-views][] for full reference.```js
const render = require('koa-views-render');// ...
app.use(render('home'));
```> With optional `locals` object argument:
```js
app.use(render('about', { title: 'About Us' });
```## Contributors
| Name | Website |
| -------------- | -------------------------- |
| **Nick Baugh** | |## License
[MIT](LICENSE) © [Nick Baugh](http://niftylettuce.com/)
##
[npm]: https://www.npmjs.com/
[yarn]: https://yarnpkg.com/
[koa]: http://koajs.com
[lad]: https://lad.js.org
[koa-views]: https://github.com/ladjs/koa-views