Skip to content

Latest commit

 

History

History
88 lines (64 loc) · 2.24 KB

README.md

File metadata and controls

88 lines (64 loc) · 2.24 KB

Warning

This package is no longer maintained. It will not receive updates, fixes or support. PostHTML itself can be used directly: https://github.com/posthtml/posthtml

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