ericf / express-handlebars

A Handlebars view engine for Express which doesn't suck.
BSD 3-Clause "New" or "Revised" License
2.31k stars 382 forks source link

Register partials on Handlebars global #137

Open edorsey opened 9 years ago

edorsey commented 9 years ago

This PR registers the partials on the Handlebars global. This makes it possible to use the handlebars-layouts module instead of using the layouts built into this module. In my opinion theexpress-layouts has some nice features that make it generally a more full-featured layout implementation - fairly equivalent to jade layouts.

I added a development flag that can be passed in. All this flag does is tell re-register the partials on every render. Turning this on makes it so that you can change one of the partials that makes up the layout and the change appears on the next render without having to restart the server.

I'm not sure that this change is even desired, but I implemented it and plan on using it on a few projects, so I figured I'd at least submit a PR. I can update the Read Me, etc if you do want to incorporate these changes.

boushley commented 8 years ago

I use a helper that renders a dynamic partial specified in context. This change enables that to function properly without needing to manually register partials.