2016-02-27 15 views
16

TypeError: dest.on is not a functionというエラーが発生しました。このタスクを実行するとき、私は何が間違っているのか理解できません。なぜこのエラーが発生しますか? dest.onは関数ではありません - gulp-file-includeを使用しています

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('./')); 
}); 

答えて

21

このライン:

.pipe(fileinclude) 

はこのことする必要があります

.pipe(fileinclude()) 
+0

カントは、私は大爆笑ことを逃したと信じてどうもありがとうございました。 は、あなたは私がpath.joinを使用しようとしたとき(paths.templatesを、なぜ「* .tpl.html)、それはエラーパスを与えるだろう が定義されていない – 91eahz

+1

あなたはおそらく '忘れたVARパス=必要(」パス ')'知っているだろう。 –

+1

おかげさまでありがとう、私はまだ学んでいますが、ゆっくりと物事をすべて魅力のように働かせています。素晴らしい一日を – 91eahz

関連する問題