Gulp 如何让大口车把识别零件
我很难让车把找到我的零件。我有一个嵌套文件夹结构,如下所示:Gulp 如何让大口车把识别零件,gulp,handlebars.js,Gulp,Handlebars.js,我很难让车把找到我的零件。我有一个嵌套文件夹结构,如下所示: some/local/path/handlebars/shared/_shared.hbs some/local/path/handlebars/nested/template1.hbs some/local/path/handlebars/nested/template2.hbs 我认为默认情况下,handlebar应该将所有以下划线开头的文件标记为部分文件,但在输出中没有看到任何对“registerPartials”的调用。下面
some/local/path/handlebars/shared/_shared.hbs
some/local/path/handlebars/nested/template1.hbs
some/local/path/handlebars/nested/template2.hbs
我认为默认情况下,handlebar应该将所有以下划线开头的文件标记为部分文件,但在输出中没有看到任何对“registerPartials”的调用。下面是我对吞咽任务的最后一次修改。我似乎不知道如何调试这个-也许我已经盯着它太久了
gulp.task('template', function() {
return gulp.src(paths.templates)
.pipe(handlebars())
.pipe(wrap('Handlebars.template(<%= contents %>)'))
.pipe(declare({
namespace: 'myapp.templates',
noRedeclare: true,
processName: function(filePath) {
return someFunction(filePath);
}
}))
.pipe(concat('templates.js'))
.pipe(gulp.dest('output/path'));
});
知道我做错了什么吗?另外,出于好奇(也许这是我的问题的一部分),但是processName在生成名称空间之外还有其他用途吗
提前感谢您的帮助 不,它不会自动生成分部。你需要自己处理。
some/local/path/handlebars/**/*.hbs