I am trying to compile the files .hbs files inside components/client folder. Compiling working fine.
I am having issue with adding the subfolder names in the partial name.
Here is my code.
handlebars: {
build: {
options: {
partialRegex: /.*/,
partialsPathRegex: /\/components\/client\//,
namespace: 'tmpl',
processName: function(filePath) {
// Extract subfolder name and join it with the file name (excluding extension)
var subfolderMatch = filePath.match(/\/([^\/]*)\/[^\/]*\.hbs$/);
var subfolder = subfolderMatch ? subfolderMatch[1] + '/' : '';
return subfolder + filePath.replace(/^.*[\\\/]/, '').replace('.hbs', '');
},
},
files: {
'public/js/tmpl.js': ['views/components/client/*.hbs', 'views/components/client/**/*.hbs'],
},
},
}
Found the answer.
Try this.