Use pre-compiled Handlebars client-side templates in your app.
Add ss-handlebars 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 accessibale via the
Note: Handlebars uses a small client-side runtime which renders the pre-compiled templates. This file is included and automatically sent to the client.
E.g. a template placed in
Can be rendered in your browser with
// assumes var ss = require('socketstream')var html = sstmpl'offers-latest'name: 'Special Offers'
When experimenting with Handlebars, or converting an app from one template type to another, you may find it advantageous to use multiple template engines and confine use of Handlebars to a sub-directory of
Directory names can be passed to the second argument as so: