# hapi-posthtml
**Repository Path**: mirrors_posthtml/hapi-posthtml
## Basic Information
- **Project Name**: hapi-posthtml
- **Description**: PostHTML for Hapi
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-25
- **Last Updated**: 2025-09-28
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[![NPM][npm]][npm-url]
[![Deps][deps]][deps-url]
[![Tests][build]][build-url]
[![Coverage][cover]][cover-url]
[![Standard Code Style][style]][style-url]
[![Chat][chat]][chat-badge]
# Hapi PostHTML
## Install
```bash
npm i -S hapi-posthtml
```
## Usage
```js
import Hapi from 'hapi'
import vision from 'vision'
import posthtml from 'hapi-posthtml'
const server = new Hapi.Server()
// Create server
server.connection({
host: 'localhost',
port: 3000
})
// Vision for view support
server.register(vision, err => {
if (err) {
throw err
}
// PostHTML
server.views({
path: 'public/views/',
engines: {
'html': posthtml
},
relativeTo: __dirname,
compileMode: 'async'
compileOptions: {
// PostHTML Plugins
plugins: [/* Plugins */]
}
})
})
// Create route handlers
const handlers = {
root: function (request, reply) {
reply.view('index')
},
local: function (request, reply) {
reply.view('index', { plugins: [/* Plugins */] })
},
extend: function (request, reply) {
reply.view('index', { plugins: [/* Plugins */], extend: true})
}
}
// Create routes
server.route({
method: 'GET',
path: '/',
handler: handlers.root
})
server.route({
method: 'GET',
path: '/local',
handler: handlers.local
})
server.route({
method: 'GET',
path: '/extend',
handler: handlers.extend
})
server.start((err) => {
if (err) {
throw err
}
console.log('=> Server:', server.info.uri)
})
```
## Maintainers
Michael Ciniawsky |