/koa-posthtml

PostHTML for Koa

Primary LanguageJavaScriptMIT LicenseMIT

NPM Deps Tests Coverage Standard Code Style Chat

Koa PostHTML

Install

npm i -S koa-posthtml

Usage

'use strict'

import { join } from 'path'

import koa from 'koa'
import posthtml from 'koa-posthtml'

const app = koa()

// Setup View Engine
posthtml(app, {
  ext: 'html',
  root: join(__dirname, 'views'),
  options: {/* Options */},
  plugins: [/* Plugins */]
  writeResp: true
})

app.use(function * () {
  // Render index.html
  yield this.render('index')
})

app.on('error', (err) => console.error('=> Server error', err))

app.listen(3000, () => console.log('=> Server started'))

Maintainers


Michael Ciniawsky

Contributing

See PostHTML Guidelines and contribution guide.

LICENSE