ringo / ringojs

RingoJS is a JavaScript platform built on the JVM and optimized for server-side applications.
https://ringojs.org
Apache License 2.0
838 stars 101 forks source link

Add means to render external skins from within a skin #53

Closed robi42 closed 14 years ago

robi42 commented 14 years ago

E.g., <% include ./foo.html %> (this would render external ./foo.html skin resource as subskin named ./foo.html).

earl commented 14 years ago

I pushed a basic include implementation to http://github.com/earl/ringojs/tree/skins-include.

<% include name=n resource=r %> adds the skin created from resource r as subskin n, allowing it to be used just as an internal subskin. The name parameter is optional, defaulting to the resource path. The named argument resource can also be given as first positional argument.

So the minimal usage example would probably be:

<% include ./foo.html %>
<% render ./foo.html %>

Which includes a skin created from ./foo.html as subskin named ./foo.html. This subskin is then immediately rendered.

hns commented 14 years ago

thanks! have you considered doing this without the <% include %>, i.e. just loading the external skin if no internal subskin exists with the given name?

earl commented 14 years ago

ok, updated my branch to get rid of the include.

earl commented 14 years ago

merged mainline in 7164ef4c5f516b073dba52f693f3221b7b01d54c.