BorisMoore / jsrender

A lightweight, powerful and highly extensible templating engine. In the browser or on Node.js, with or without jQuery.
http://www.jsviews.com
MIT License
2.68k stars 340 forks source link

isomorphic jsrender #257

Closed Mytia closed 9 years ago

Mytia commented 9 years ago

Hi,Boris. Is it possible and in plans to support

  1. data-link attribute in jsrender for easiest jsviews-templates rendering on server side.
  2. create data or at least part of data and templates on client from html, rendered on server with jsrender.
BorisMoore commented 9 years ago

There are already some users who are using the same template on the server, with JsRender render() and then on the client using JsViews link(). So at least part of the above scenarios is already possible.

Currently you can use a template like

{^{for people}}...{^{:firstName}} ... <span data-link="lastName"></span> ... {{/for}}

on the server, and it will render exactly the same as

{{for people}}...{{:firstName}} ... <span></span> ... {{/for}}.

So then on the client you would need to re-render it using link() and the result would be that the user might see a 'flash' as the lastName gets rendered.

And yes, you could create the data, or part of it, as part of the initial rendering from the server.

For V1.0, there will be some Node.js integration, along with the above behavior. For more extensive built-in support and features concerning these scenarios - that will be a feature request for after V1.0

See also https://github.com/BorisMoore/jsviews/issues/69

BorisMoore commented 9 years ago

Closing "After V1.0" issues for now - to reopen as appropriate.