baryshev / ect

Fastest JavaScript template engine with embedded CoffeeScript syntax
http://ectjs.com
MIT License
626 stars 70 forks source link

Add a way to provide a composite context with <% include %> #88

Open tifosiblack opened 9 years ago

tifosiblack commented 9 years ago

Hello Vadim,

I propose this pull request, in order to be able to pass a 'this' extended context through an include.

This way I'm able to include reusable component like that and still be able to use global headers, like translation, defined into 'this' :

<% include 'runtime/components/media', @, { media: @exercise.media } %>
<% include 'runtime/components/media', @, { media: @other.media } %>

Context is merge into a new object in this case. The behaviour is unchanged in other cases.