RandomEtc / ejs-locals

Express 3.x layout, partial and block template functions for the EJS template engine.
298 stars 63 forks source link

Client side templating? #33

Open srlowe opened 11 years ago

srlowe commented 11 years ago

Love the package, but trying to use the same template on server and client side. Have tried using the visionmedia/ejs client side library, unfortunately it expects a 'foreach' in the template, whereas ejs-locals partial does not. Is there a recommended way to do this, or is client-side support coming?

Thanks.

RandomEtc commented 11 years ago

I'm not actively working on any new features but will try to take pull requests if they don't complicate or confuse things on the node side.

Vadorequest commented 10 years ago

Using the framework sails.js (https://github.com/balderdashy/sails) you can have shared templates in client/server natively. (managed by sails) Just put your templates in the assets/linker/templates (use --linker when creating the sails project, see https://github.com/balderdashy/sails-docs/blob/0.9/getting-started.md)

Any template will be automatically available in the client code (in the global JST variable). (If you're using EJS, if not then you'll have to do your own implementation). That's just a tip, sails is a good framwork, maybe it can help you, maybe not.