ericf / express-handlebars

A Handlebars view engine for Express which doesn't suck.
BSD 3-Clause "New" or "Revised" License
2.31k stars 383 forks source link

Using Helpers on Client and Server #88

Closed neurofuzzy closed 9 years ago

neurofuzzy commented 9 years ago

It would be great if you added a client-side helper to your advanced example. I am unclear on how to use the same helpers code on both the client and server.

Is this the correct way? http://codyrushing.com/using-handlebars-helpers-on-both-client-and-server/

ericf commented 9 years ago

Yeah that works. Helpers are just functions so as long as you write the file they're contained in such that it can run both in Node.js and in the the browser it'll work.