Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Hogan.js for Express with support for Template Partials.
CoffeeScript JavaScript Shell
Branch: master

Merge pull request #16 from adamterlson/patch-1

Update package.json to be tied to coffee version
latest commit a6a730f3b9
@quangv authored
Failed to load latest commit information.
cakes Partials on sub-view folders working. #2
example Examples & Usage added.
spec Exports parsePartials
views .hulk moved to views folder
.gitignore Added first mocha-cakes, express_engine
LICENSE MIT License added to project.
Makefile --globals log added to Makefile test utils Added how to run tests documentation.
cut change to using fat-arrow for __express method
index.js index.js, loads
package.json Update package.json to be tied to coffee version


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

Hi {{name}}

{{> salute}}

Why is Hogan.js Awesome?

Logic-less templates, keeping control separate from views. Views separated from content.

Doesn't have many bells and whistles. HTML Structure, and views are suppose to be simple.

Mustache is awesome. Has many implementations. It's clear what's a {{variable}} and what is not.

Why Hulk-Hogan?

Becaues he's awesome. But also because there wasn't a solution I could find that let's you easily use Mustaches' partials natively with Express.

Partials Example


  {{> header}}
  My body.
  {{> footer}}


<h1>Hey There</h1>


<footer>See ya</footer>


  <h1>Hey There</h1>
  My body.
  <footer>See ya</footer>

Sub-Partials supported

You can link partials from within other partials.





Usage Example


Hello {{what}}!


  express = require 'express'
  hulk = require 'hulk-hogan'

  app = express.createServer()

  app.set 'views', __dirname+'/views'  # Directory of your views
  app.set 'view options', layout:false
  app.set 'view engine', 'hulk'  # use the .hulk file extensions for your views
  app.register '.hulk', hulk  # register to render .hulk with Hulk-Hogan

  app.get '/', (req,res)->
    res.render 'index', {what:'World'}

  app.listen 3000

coffee http://localhost:3000 would produce:

Hello World!



 var app, express, hulk;

 express = require('express');
 hulk = require('hulk-hogan');

 app = express.createServer();

 app.set('views', __dirname + '/views');
 app.set('view options', {layout: false});
 app.set('view engine', 'hulk');
 app.register('.hulk', hulk);

 app.get('/', function(req, res) {
   res.render('index', {
     what: 'World'


node app.js http://localhost:3000 would produce:

Hello World!

Automated Tests

Hulk-Hogan uses mocha & mocha-cakes for testing.

make buffet should run all tests.


Hulk-Hogan inspired by HBS

should checkout express-hogan.js

and Micah Smith's hogan-express.js blog post for reference.

Special Thanks to the Hogan.js Twitter Team, as well as Hulk-Hogan's grand-dad, (or is it more like Great Uncle?) Mustache.

Also Thanks to TJ for the excellent Express and Express-Resource.

Something went wrong with that request. Please try again.