Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 3 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 (4 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
[![code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![made with lass](https://img.shields.io/badge/made_with-lass-95CC28.svg)](https://lass.js.org)
[![license](https://img.shields.io/github/license/ladjs/koa-views-render.svg)](<>)> 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