Open mdelbuono opened 3 years ago
I fixed it as follows:
registerPartials(path.resolve(escapeGlob(__dirname), './partials/**/*.hbs'))
Where the escapeGlob
function is defined below:
function escapeGlob (glob) {
return glob
.replace(/\\/g, '\\\\')
.replace(/\*/g, '\\*')
.replace(/\?/g, '\\?')
.replace(/\[/g, '\\[')
.replace(/\]/g, '\\]')
.replace(/\{/g, '\\{')
.replace(/\}/g, '\\}')
.replace(/\)/g, '\\)')
.replace(/\(/g, '\\(')
.replace(/\!/g, '\\!');
}
In
index.js
, line 92 loads the default partials as follows:The glob path gests unfolded usign
FileSet
which in turns usesglob
. The problem is that, if__dirname
contains special glob characters (e.g.[ ]
like in my case),FileSet
will fail listing all the .hbs files and no partial will be registered.Bottomline is:
__dirname
should be escaped.