shannonmoeller / gulp-hb

A sane Gulp plugin to compile Handlebars templates. Useful as a static site generator.

Home Page:http://npm.im/gulp-hb

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reintroduce `dataEach` or similar.

shannonmoeller opened this issue · comments

The dataEach option was dropped when @root and @file were introduced. Current solution of using @file.data seems less than ideal.

#10 (comment)

@backflip Thank you for PR #48, but I wonder if we can address this differently. I'm not a fan of the hook that would make @root equivalent to @file.data in some circumstances. I think I'd rather add another @ alias like @local or @data.

Would something like that be sufficient to solve the usecase in unic/estatico#36?

I think the real cause of this issue is in handlebars-wax. It is overriding the meaning of @root to be the global data, rather than the object that's passed to the template. If I don't override @root there, this problem goes away and everything will work as expected in estatico.

This issue was addressed in handlebars-wax and published as v5. I have pulled in this new version to gulp-hb and published as v6.

The value of @root should now be as @swey expected in unic/estatico#36.