Name parsing with 3.0+ / handlebars-wax
loremipson opened this issue · comments
I'm trying to upgrade from 2.6.5
to 4.0.3
The parsePartialName()
, etc. functions seem to be a little different. I've checked the handlebars-wax
. I don't think the file.exports
will work out well in my situation, so what I can do is run replacements on file.path
:
parsePartialName: function(file){
return file.path.replace(file.base, '');
}
The problem here is that I'm passing an array as my hb partials, ie:
.pipe(hb({
partials: ['./something/**/*.hbs', './somethingElse/**/*.hbs']
})
And only the partials in the first array index are having my "replacement" applied, rather than all of them.
Is the problem here that I'm passing an array? Should I now be using the .partials('./something/**/*').partials('./somethingElse/**/*')
? Or should an array still be fine?
You hit the nail on the head. Using the .partial()
method, etc, is recommended when globbing multiple directories.
Arrays work a little differently now due to a change to the require-glob
module. Files get a base path based on the non-globbed portion of the first pattern in a give array.
Excellent, thank you. I figured, but it isn't simple for me to try that out currently. I'm passing the values to hb()
via a project configuration file.. So I'll need to figure that out, but that's clearly on my end.
Thanks again.
I'll be addressing that issue when I incorporate this update into grunt-hb
. I'm planning to use a pattern like this:
{
partials: [
{
pattern: './something/**/*.hbs'
},
{
pattern: ['./something/**/*.hbs', '!**/layout.hbs'],
cwd: __dirname
}
]
}
Each option in the array would count as a call to the .partial()
method. It's a really awkward syntax which I why I don't plan to expose it here, and prefer to point people to the fluent api.
Thoughts?