ejs-locals icon indicating copy to clipboard operation
ejs-locals copied to clipboard

Client side templating?

Open srlowe opened this issue 13 years ago • 2 comments

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.

srlowe avatar Mar 29 '13 08:03 srlowe

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.

RandomEtc avatar Mar 29 '13 21:03 RandomEtc

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.

Vadorequest avatar Aug 17 '14 21:08 Vadorequest