assemble/grunt-assemble

Multiple partials with same file name, in different directories

burtyish opened this issue · 2 comments

I'm trying to migrate a large project to assemble. I have two partials named header.hbs, placed in different directories like this:
../partials/foo/header.hbs
../partials/bar/header.hbs

I've tried {{> foo/header }} and {{> 'foo/header' }} but those fail with Warning: The partial foo/header could not be found.

I can see in the verbose output that two partials with name header are created. {{> header }} succeeds, but will always return the second file (probably since it was the last one registered).

How can I reference a specific header partial?

doowb commented

grunt-assemble will only use the basename of the partial's filepath.

There is a registerPartial option that can be a function that gets the engine (handlebars), filename, and content properties.

This won't really help you here because filename will always be header.

Since we moved the original assemble code into this library, I think we'll consider any PRs that can make this easier and we can use proper semver versioning. Eventually, we'll be using more of the new features in assemble (like renameKey) which takes the entire filepath and allows updating how the key is created.

I see.
Thank you for the prompt reply.