Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass context.view to partials function #619

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

taylorc93
Copy link

This idea arose from a project that I'm working on where I need to handle the logic for loading my own partials. This is because there might be hundreds of partials and I don't want to load all of them into memory (AKA using a partials object).

From parsing through the source code, I saw that the partials parameter for renderPartial can be a function. Great! However, when rendering through a function, I also need access to the context for the partial and currently, only the name of the partial is provided. This is where this PR comes is 馃槃.

@phillipj
Copy link
Collaborator

Thanks for contributing 馃憤

This sounds good to me. Could you add a test ensuring this works as intended?

@taylorc93
Copy link
Author

Sure thing! Busy tonight but will do this tomorrow

@taylorc93
Copy link
Author

Sorry for the delay, got caught up with other things. I noticed while trying to add a test that there was no check for retrieving partials using a function rather than an object, so that's what the test I wrote ensures. To do so however, I had to modify test/render-test.js slightly. Please advise if you have a better solution in mind or need anything else before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants