Gulp 吞咽注入任务不';使用运行序列调用时无法工作

Gulp 吞咽注入任务不';使用运行序列调用时无法工作,gulp,gulp-inject,run-sequence,Gulp,Gulp Inject,Run Sequence,所需步骤 "devDependencies": { "del": "^2.2.0", "gulp": "^3.9.0", "gulp-inject": "^3.0.0", "gulp-typescript": "^2.10.0", "run-sequence": "^1.1.5" } gulp.task('clean', function() { return del('build'); }); gulp.task('ts', funtion() {

所需步骤

"devDependencies": {
   "del": "^2.2.0",
   "gulp": "^3.9.0",
   "gulp-inject": "^3.0.0",
   "gulp-typescript": "^2.10.0",
   "run-sequence": "^1.1.5"
}

gulp.task('clean', function() {
   return del('build');
});

gulp.task('ts', funtion() {
   var tsProject = ts.createProject('tsconfig.json');
   return tsProject.src('src/**/*.ts')
        .pipe(ts(tsProject))
        .js.pipe(gulp.dest('build'));
});

gulp.task('inject', funtion() {
   return gulp.src('index.html')
        .pipe(inject(gulp.src('build/**/*.js', {read: false}), {ignorePath: 'build', relative: true}))
        .pipe(gulp.dest('build'));
});

gulp.task('build', function() {
   runSequence('clean', 'ts', 'inject');
});
  • clean build
    目录
  • 编译typescript文件
    然后将编译后的文件放入构建目录
  • 将编译后的文件作为脚本注入index.html,然后将其放入构建目录
  • 项目结构

    -- build
    -- src
       --app
         --app.ts
         ..
    -- index.html
    
    index.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
    </head>
    <body>
        <!-- inject:js -->
        <!-- endinject -->
    </body>
    </html>
    
    问题

    当我执行
    gulp ts&&gulp inject
    时,它工作得非常好

    当我执行
    gulp build
    时,
    inject
    在没有打印消息的情况下无法工作


    我认为运行顺序有问题。你能帮我找出问题和解决方法吗?

    经过几个小时的挖掘,我意识到当任务返回适当的流时,运行序列停止运行,没有任何警告或错误。
    希望这能帮助其他有同样问题的人。

    您能告诉我您所说的“在适当的流中”是什么意思吗。请用一些代码详细说明您的答案。@SrikanthReddyKarnati问题中有代码。尝试聚焦
    清理任务
    ,它不会返回正确的流,因此序列停止在那里。