Closed joanniclaborde closed 10 years ago
(this is a rewrite of https://github.com/ericf/express3-handlebars/pull/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:
partialsDir
dir
namespace
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:
local/views
/otherPackage/shared/views
status.hbs
{{> status}} {{> otherPackage/status}}
Thanks! I merged this in.
Thanks Eric!
(this is a rewrite of https://github.com/ericf/express3-handlebars/pull/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. EachpartialsDir
can optionally be specified as an object, with adir
andnamespace
properties. Example:If both
local/views
and/otherPackage/shared/views
contain a template namedstatus.hbs
, they can be included like this in a view: