Closed samharnack closed 11 years ago
Could you also provide a use case and example for "template inheritance"?
It's more about supporting nested templates and not having to use partials as headers and footers. I think for larger sites that could become a maintenance nightmare. Using partials is still there as its part or handlebars itself. See here for an example and also where the code was derived from: http://thejohnfreeman.com/blog/2012/03/23/template-inheritance-for-handlebars.html
Thanks for the link. Yeah I see what you're trying to do. However, I'm still not convinced how that could be problematic in a larger site. In my opinion, an inheritance system like what you're describing makes it much harder to customize because templates are based off of 1 general template. In a large site with many different templates, inheritance defeats the purpose because you end up writing more templates.
A modularized components approach (the inclusion approach mentioned in the article) is in my opinion more effective in being used across very different templates, thus increase code reuse.
This pull request doesn't change the ability to do that. It just adds the ability to nest templates.
A couple things:
partial
and block
helper, because I don't think those are very clear.Thanks.
This PR is a little premature. There is an issue with nesting templates and scoping of partials. Once I get it ironed out I will submit another PR with more examples and answers to your questions.
Okay thanks. Submit another PR and I will merge it in. I like the idea that this allows for using inheritance template without breaking the original template idea.
About your layout and index templates - correct me if I'm wrong, but it seems like you are trying to change the Handlebars template to fit the scheme of the original jade template. Originally I had a different idea of how Handlebars template should work. It is not based on a main layout with customizable components. It is more like a bunch of smaller components that could be used in different templates.