https://github.com/nullfirm/hjs
Hogan.js NPM package for express 3.x (hjs)
https://github.com/nullfirm/hjs
Last synced: about 13 hours ago
JSON representation
Hogan.js NPM package for express 3.x (hjs)
- Host: GitHub
- URL: https://github.com/nullfirm/hjs
- Owner: nullfirm
- License: apache-2.0
- Created: 2012-06-11T14:36:52.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2017-03-08T09:37:09.000Z (almost 9 years ago)
- Last Synced: 2025-10-12T05:13:03.327Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 29
- Watchers: 3
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs-keynotes - hjs
README
hjs
=====
[Hogan.js](http://twitter.github.com/hogan.js/) NPM package for [express](http://expressjs.com/) 3.x
## Installation
$ npm install -g express@3.0 hjs
## Quick Start
Install Express :
$ npm install -g express@3.0
Create express app :
$ express -H /tmp/testapp
$ cd /tmp/testapp/
& npm install
## Manual Start
Install Express :
$ npm install -g express@3.0
Create express app :
$ express /tmp/testapp
$ cd /tmp/testapp/
Edit package.json :
$ vi package.json
```json
"dependencies": {
"express": "3.0.0",
"hjs": "*"
}
```
$ npm install
Edit app.js :
```js
app.set('view engine', 'hjs');
```
Make views/index.hjs :
```html
{{ title }}
{{ title }}
```
Start server :
$ node app
## Partials
index.hjs
```html
{{ title }}
{{ title }}
{{> footer }}
```
footer.hjs
```html
My awesome footer
```
To use a partial once:
```js
res.render('index', {
title: 'My Test App',
partials: {footer: 'footer'}
});
```
To include a partial on every page:
```js
app.set('partials', {footer: 'footer'});
```
## More Information
[express](http://expressjs.com/) is Fast, unopinionated, minimalist web framework for [node](http://nodejs.org).
[Hogan.js](http://twitter.github.com/hogan.js/) is a compiler for the
[Mustache](http://mustache.github.com/) templating language. For information
on Mustache, see the [manpage](http://mustache.github.com/mustache.5.html) and
the [spec](https://github.com/mustache/spec).