Closed WolfieZero closed 8 years ago
I don't see anything obviously wrong. Can you add the debug flag to the options you pass into hb() and post the output?
...
.pipe(hb({
debug: true,
data: [
...
Heh, looks like it's due to there being a space in one of the folders leading up to the project folder. Just ran it again and the contexts where correct. Thanks for the tip on the debug
setting.
I don't normally have spaces in folders but on this particular machine Dropbox made it so.
Before
data-test.html
context:
Dropbox (Personal)
data:
decorators:
inline
helpers:
blockHelperMissing helperMissing log unless
each if lookup with
partials:
Dropbox-(Personal)/Code/email-builder/src/html/partials/boom Dropbox-(Personal)/Code/email-builder/src/html/partials/show
partial-test.html
context:
Dropbox (Personal)
data:
decorators:
inline
helpers:
blockHelperMissing helperMissing log unless
each if lookup with
partials:
Dropbox-(Personal)/Code/email-builder/src/html/partials/boom Dropbox-(Personal)/Code/email-builder/src/html/partials/show
After
data-test.html
context:
var
data:
decorators:
inline
helpers:
blockHelperMissing helperMissing log unless
each if lookup with
partials:
boom show
partial-test.html
context:
var
data:
decorators:
inline
helpers:
blockHelperMissing helperMissing log unless
each if lookup with
partials:
boom show
Thanks for the output. Looks like I'll need to update the path handling to account for that.
Glad you got a workaround!
Edit: Changed title of issue to reflect actual bug.
👍 Awesome, thanks for the help!
@WolfieZero I just released 5.1.2 with some path fixes to another issue. I'm curious if those fixes address this issue as well. Any chance you're still working on this and able to test it?
I just happened to run into this same issue today. Same thing, project in Dropbox. (Update: I’m using 5.1.2, so recent changes don’t seem to resolve this across the board.)
I think it might be an issue upstream in handlebars-wax, specifically the keygenPartial
function.
It’s handy that this can be passed in as an option (both to handlebars-wax and to grunt-hb). I passed in following, which seems to work.
var fs = require('fs');
var path = require('path');
function parsePartialName(options, file) {
var realPath = fs.realpathSync(file.path);
return path.basename(realPath, path.extname(realPath));
}
Thanks, @ry5n! I'll setup a test case in handlebars-wax and update this project when that's been updated.
Found the bug was one layer deeper in require-glob. The issue wasn't spaces, but parentheses that caused a glob mismatch. Patch coming soon.
Released 5.1.4 which resolves this issue.
Updated to 5.1.4; working like a charm. Thanks!
I have the following gulp task setup.
gulpfile.js
src/html/data/var.json
src/html/data-test.html
src/html/partial-test.html
src/html/partials/boom.hbs
src/html/partials/show.hbs
With the data, the file returns empty and the partials returns this error.
Really confused what I'm doing wrong 😕
Thanks.