1.0.0 • Published 6 months ago

connect-renderer v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

NPM version Build Status Dependency Status

connect-renderer

Connect compatible implementation of template renderer. Inspired and based on res.render() implementation in Express

To be used where entire express functionality is not needed.

Install

$ npm install --save connect-renderer

Usage

const connect = require('connect');
const app = connect();
const renderer = require('connect-renderer');

app.use(renderer(VIEWS_DIR).engine('pug', {
  compile: require('pug').compile,
  options: {
    // all options are passed to `compile` function
    compileDebug: process.env.NODE_ENV !== 'production'
  }
}));

app.use('/page', (req, res) => {
  // req.app.locals and res.locals are merged with options passed to `render`
  res.render('page', { title: 'Page'});
})

License

MIT © Damian Krzeminski

1.0.0

6 months ago

0.2.0

6 months ago

0.1.1

6 months ago

0.1.0

6 months ago

0.0.0

7 months ago