node package manager


Hogan template engine wrapper providing server-side compiled templates for SocketStream apps

Hogan Template Engine wrapper for SocketStream 0.3

Use pre-compiled Hogan (Mustache-compatible) client-side templates in your app to benefit from increased performance and a smaller client-side library download.

Note: ss-hogan is installed by default with new apps created by SocketStream 0.3 alpha2 onwards.

First download template.js from and add this to your /client/code/lib folder. This is the Hogan VM which renders pre-compiled templates. It is smaller in size than the all-inclusive hogan.js file which includes the compiler and should not be sent to the client.

Secondly, add ss-hogan to your application's package.json file and then add this line to app.js:


Restart the server. From now on all templates will be pre-compiled and attached to the HT window/global variable.

E.g. a template placed in


Can be rendered in your browser with

html = HT['offers-latest'].render({name: 'Special Offers'})

When experimenting with Hogan, or converting an app from one template type to another, you may find it advantageous to use multiple template engines and confine use of Hogan to a sub-directory of /client/templates.

Directory names can be passed to the second argument as so:

ss.client.templateEngine.use(require('ss-hogan'), '/hogan-templates');

To specify another global/window variable instead of HT set the 'namespace' option in the config as so:

ss.client.templateEngine.use(require('ss-hogan'), '/', {namespace: 'MyVar'});