0.0.1 • Published 9 years ago
h-js v0.0.1
h-js
Hogan.js NPM package for express 3.x Forked from https://github.com/nullfirm/hjs due to no support on the original repository. We promise to support this package with all our goodness.
Installation
$ npm install -g express@3.0 h-jsQuick Start
Install Express :
$ npm install -g express@3.0Create express app :
$ express -H /tmp/testapp
$ cd /tmp/testapp/
& npm installManual Start
Install Express :
$ npm install -g express@3.0Create express app :
$ express /tmp/testapp
$ cd /tmp/testapp/Edit package.json :
$ vi package.json"dependencies": {
"express": "3.0.0",
"h-js": "*"
}$ npm installEdit app.js :
app.set('view engine', 'h-js');Make views/index.hjs :
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<p>{{ title }}</p>
</body>
</html>Start server :
$ node appPartials
index.hjs
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<p>{{ title }}</p>
{{> footer }}
</body>
</html>footer.hjs
<div>My awesome footer</div>To use a partial once:
res.render('index', {
title: 'My Test App',
partials: {footer: 'footer'}
});To include a partial on every page:
app.set('partials', {footer: 'footer'});More Information
express is Fast, unopinionated, minimalist web framework for node.
Hogan.js is a compiler for the Mustache templating language. For information on Mustache, see the manpage and the spec.
0.0.1
9 years ago
