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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Each partials dir can be namespaced (with Promises) #70

Merged
merged 1 commit into from
Aug 5, 2014

Conversation

joanniclaborde
Copy link
Contributor

(this is a rewrite of #64, based on https://github.com/ericf/express3-handlebars/tree/promises)

As stated in #20, having multiple partialsDir can introduce naming collisions. This pull request adds support for partials namespaces. Each partialsDir can optionally be specified as an object, with a dir and namespace properties. Example:

var partialsDir = [
  'local/views',
  {dir: '/otherPackage/shared/views', namespace: 'otherPackage'}
];
...
app.engine('handlebars', exphbs({partialsDir: partialsDir}));

If both local/views and /otherPackage/shared/views contain a template named status.hbs, they can be included like this in a view:

{{> status}}
{{> otherPackage/status}}

@ericf ericf merged commit f60e675 into ericf:promises Aug 5, 2014
@ericf
Copy link
Owner

ericf commented Aug 5, 2014

Thanks! I merged this in.

@joanniclaborde
Copy link
Contributor Author

Thanks Eric!

@ericf ericf added this to the v1.0.0 milestone Aug 7, 2014
@joanniclaborde joanniclaborde deleted the namespaced-partials-promises branch September 8, 2014 13:16
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.

2 participants