tj / co-views

Higher-level template rendering for node.js using generators
173 stars 24 forks source link

Bugfix for Hogan partials introduced in 1.0.0 #23

Closed simov closed 9 years ago

simov commented 9 years ago

The user should be able to specify partials per render call (I know it because I implemented that feature in consolidate https://github.com/tj/consolidate.js/pull/51). Prior 1.0.0 that was working without any change required to this module.

Related commit: https://github.com/tj/co-views/commit/9cdf9fd29d599bf10f5deda0a4806cb2bcf12a33 And PR: https://github.com/tj/co-views/pull/21

Now, I'm not sure what the author's idea was with defining global partials for the render, but with this fix the partials from views.options and those passed in render.options are merged. So that fixes existing clients using this combination of modules.

While on that, I don't see the point of using the utils-merge module, you can just var extend = require('util')._extend instead (for flat merge).


Somehow it corrupts partials object, so on second and subsequent renders partials object filled not with filename, but with filename contents https://github.com/tj/co-views/pull/21#issuecomment-107964781

That's implementation detail, check out the PR above.

simov commented 9 years ago

cc @marinintim @coderhaoxin

haoxins commented 9 years ago

land 26d73c202887110915124910d8c2d9061617e3bd

v2.1.0 published

simov commented 9 years ago

Thanks, that was fast :+1: