-
-
Notifications
You must be signed in to change notification settings - Fork 579
Add test for template partial rendering with a local variable. #1006
Add test for template partial rendering with a local variable. #1006
Conversation
I think the correct fix is here in the buffalo repo, instead of the plush repo, since the |
That was what I'd originally hoped, but I couldn't see an elegant way for the partial helper to access the required data: since plush is responsible for binding the arguments to the function call, and already attempts to supply missing args for global context. How do you feel if the |
I think you need to start here https://github.com/gobuffalo/buffalo/blob/master/render/template.go#L29 capture the original |
Snap! I'll do that then - thanks. |
…re global and local context is available.
…ion into buffalo from plush. Note: whilst this currently tests correctly, in a buffalo app path helper functions do not seem to function correctly.
Note that whilst this passes the test as written, I'm seeing "missing parameters" errors when using the path helpers in a buffalo app. I'll need to investigate this further. |
* adding clean-obsolete-chunks which will clean up on recompile * adding dot between css name and hash
Hi Mark,
After reading the documentation on partial rendering (https://gobuffalo.io/en/docs/partials#local-context) I expected local and global variables to be merged. This doesn't seem to happen at present. That may be the desired behaviour?
This adds a failing test case. It could be combined with the existing test case, depending on your preferred approach.
I've created a candidate fix in
plush/compiler.go
for which I'll submit an MR for review.Best wishes,
Alex