-
Notifications
You must be signed in to change notification settings - Fork 384
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for run-level partialsDir #118
base: master
Are you sure you want to change the base?
Conversation
What does the code look like that you have to use today without this feature?
I think this should be reversed: defaults coming before the theme's partials. |
yes you are correct, it should be the other way around to override. I miswrote the pseudocode and have updated the comment now. |
I think it might be confusing to have two partials related render-time options:
Which one takes precedence if both are provided? I'm not sure how popular these two features would be, but we could change what you're proposing here to be expressible using the public API without adding a new render-time option: res.render('viewer/index', {
layout: false,
partials: exphbs.getPartials({
cache: req.app.get('view cache'),
dirs: [
req.default.partialsDir,
req.theme.partialsDir
]
})
}); To implement this, we could add a |
yes this could work, though it adds an extra dependancy to A natural partials Hierarchy does seem logical as you suggest.
|
I agree that breaking the abstraction is not great. Let me think about this some more… and let's see if we can come up with something that's easier for people to reason about and understand how the concepts of |
I was thinking about the When i first saw the feature i thought it would uniquely work with files and intuitively take the form If one wanted to add a single |
for my use case I could also add the partials manually (as i know which partials are included in the specific view I'm loading).. if i could have an interface to pass in many partials at a time, i.e.
this may work for me in place of the partialsDir solution. |
Hi Ericf, Sorry it's been a while, this project has been on ice for a while.. Any more ideas on adding this feature for me? |
Use case: In our application, a single endpoint (not site wide) can be configured with different themes, as part of the theme one has the ability to override specific partials. Added support to add additional partials at run-level
I'm developing a site with a 'themeable' single route (or group of route). This is so a we can customise a given page easily using partials as hooks. For the majority of the other pages (the administration backend) no additional partials are required. So I've added the ability to pass an additional partialsDir while calling res.render()
this overrides any default partials with the themes partials. I've also made it possible to send in array of partials..