为什么我会收到此错误? dest.on不是一个函数 - 使用gulp-file-include

时间:2016-02-27 21:38:07

标签: javascript node.js gulp

我收到错误TypeError: dest.on is not a function。在运行此任务时,我无法弄清楚可能出现的问题。

var fileinclude = require('gulp-file-include');
var rename = require('gulp-rename');

var paths = {
  templates : './templates/'
}

//file include: grab partials from templates and render out html files

gulp.task('fileinclude', function() {

return gulp.src(paths.templates + '*.tpl.html')
 .pipe(fileinclude)
 .pipe(rename({
  extname: ""
 }))
.pipe(rename({
  extname: ".html"
 }))
.pipe(gulp.dest('./'));
});

1 个答案:

答案 0 :(得分:49)

这一行:

.pipe(fileinclude)

应该是这样的:

.pipe(fileinclude())