Closed mikesmullin closed 13 years ago
There isn't a great way to do this because of how JavaScript's scoping rules work. We could support content_for by putting things onto the "this" object of the scope in which the template is rendered, but that would involve changing the function's binding at runtime which might break existing code, so I'm going to avoid that. Haml.js is a more strict conversion of a template into a function that takes a locals object and returns a string.
is there an easy way to do include code in the layout HEAD tag from within a haml template / partial with Haml.js and/or Picard?
i can see that templates are processed before their layout files are, and I imagine i could write some sort of helper, but wondering if this has already been thought of and provided for.
notice how haml is able to be rendered by nesting within the Do block