gulpfile を DRY しようとしています。そこには、私が慣れていないコードの小さな重複があります。どうすればこれを改善できますか?
gulp.task('scripts', function() {
return gulp.src('src/scripts/**/*.coffee')
.pipe(coffeelint())
.pipe(coffeelint.reporter())
.pipe(coffee())
.pipe(gulp.dest('dist/scripts/'))
.pipe(gulp.src('src/index.html')) // this
.pipe(includeSource()) // needs
.pipe(gulp.dest('dist/')) // DRY
});
gulp.task('index', function() {
return gulp.src('src/index.html')
.pipe(includeSource())
.pipe(gulp.dest('dist/'))
});
index
ライブリロードを監視する必要があるため、別のタスクとして取得しましたsrc/index.html
。しかし、ソースも監視して.coffee
おり、ソースが変更された場合は、更新する必要src/index.html
もあります。
index
にパイプするにはどうすればよいscripts
ですか?