Closed loremipson closed 9 years ago
Partials are named according to the directory structure. All common parent directories are trimmed and extensions removed. So:
hb({ partials: ['./_partials/**/*.hbs'] });
with
`- _partials/
|- foo.hbs
`- bar.hbs
would register foo
and bar
as paritals. While:
hb({
partials: [
'./_partials/**/*.hbs'
'./_layouts/**/*.hbs'
]
});
with
|- _partials/
| |- foo.hbs
| `- bar.hbs
`- _layouts/
|- baz.hbs
`- qux.hbs
would register _partials/foo
, _partials/bar
, _layouts/baz
, and _layouts/qux
. I'll soon be adding a debug option which will console.log the data object keys, helpers names, and partial names to help make this more obvious.
Ah hah.. the one thing I didn't actually try.
So it seems that I only need to specify that level if it's in the
edit: Never mind, not sure what confused me before, but I do indeed need to specify _layouts
directory. Things inside _partials
are still rendering fine with: {{> filename }}
. {{> _partials/filename }}
seems to work as well, but it's not erroring with the less verbose version.{{> _partials/filename }}
I noticed that my json data doesn't seem to be pulling in anymore either, would this be related to the same issue? With my above mentioned code, I have this file:
|- _data/
| |- site.json
Which I am then just pulling into my templates with: {{site.title}}
. Similarly, nothing is pulling in with that now, where it was before. Is there an extra step in place now?
Thanks!
And I just read in previous issues about the data now requiring the filename as of 2.0, so in my current case, I need to call {{site.site.title}}
. Which is .. ugly, but easy to change.
Closing this as it's a non-issue. Thanks for the help!
I'm not quite sure when this issue came about exactly, and it might ultimately be within handlebars-layouts, but I have multiple directories set up for partials (one for layouts) and it doesn't seem to be working anymore.
Here's my gulp-hb pipe:
This was working perfectly at one point, but now upon compiling, it reports, "Error: Missing partial: 'base'" if
base.hbs
is in my_layouts
directory.If I move
base.hbs
into_partials
it works again. Which is great, but ideally, I'd have them in separate directories still to avoid potential confusion.