relax-express-hogan
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

npm version Build Status Coverage Status Dependency Status

relax-express-hogan

Connect Hogan.js with Express, with support for Partials.

Why Hogan.js?

Hogan.js is a very straighforward implementation of mustache that keeps logic out of your views.

Usage Example

views/index.html

{{> header}} {{who}}
{{> footer}}

views/header.html

<i>Hey There</i>,

views/footer.html

<footer>See ya</footer>

app.js

import express from 'express'
import expressHogan from 'relax-express-hogan'
 
const app = express()
 
app.set('views', __dirname + '/views')
app.set('view engine', 'html')
app.register('html', expressHogan)
 
app.get('/', (req, res) => {
  res.render('index', {
    who: 'World'
  })
})
 
app.listen(3000)
% node app.js
% curl http://localhost:3000
<i>Hey There</i>, World
<footer>See ya</footer>

Package Sidebar

Install

npm i relax-express-hogan

Weekly Downloads

0

Version

0.2.0

License

Apache-2.0

Last publish

Collaborators

  • tokyo-jesus