0

興味深い gulpfile は次のとおりです。

gulp.task 'index', ['coffee:build', 'templates:build', 'bower', 'sass:build', 'frontend:assets'], ->
  bowerCss = gulp.src ["bower_components/**/*.css"], cwd: 'frontend'
  appJs = gulp.src ["scripts/**/*.js"], cwd: 'frontend'
  appCss = gulp.src ["**/*.css", '!bower_components/**'], cwd: 'frontend'
  return gulp.src 'web/index.html'
  .pipe plugins.inject appJs.pipe(plugins.angularFilesort())
  .pipe plugins.inject appCss
  .pipe plugins.debug()
  .pipe plugins.inject bowerCss, {name: 'bower'}
  .pipe plugins.debug()
  .pipe gulp.dest 'frontend'

それを呼び出すと、いくつかのファイル名が index.html に挿入されます。それは正常に動作します。

より大きなバッチの一部として呼び出すと、次のようになります。

gulp.task 'develop', [
  'backend:coffee'
  'backend:copy'
  'backend:serve'
  'frontend:serve' # index is required by frontend:serve
  'coffee:watch'
  'sass:watch'
  'templates:watch']

それは一種のフィズルです。gulp-inject と gulp-debug から適切に見える出力を取得する代わりに、gulp-debug から次のように取得します。

[23:06:59] Starting 'index'...
[23:06:59] Starting 'templates:watch'...
[23:06:59] gulp-debug: end event fired (2014-08-03 06:06:59 UTC)
[23:06:59] gulp-debug: end event fired (2014-08-03 06:06:59 UTC)
[23:06:59] Finished 'index' after 188 ms

gulp frontend:serve を実行でき、正常に動作することは注目に値します。これは、「すべてを起動する」コマンドを実行しているときにのみエラーになります。並列化や競合状態で問題が発生していると思いますが、エンドイベントがそのように意地悪に発火するのは奇妙です。

現在、このセットアップで、gulp frontend:serve、gulp backend:serve を 2 つの異なる端末で実行できますが、問題ありません。しかし、gulp frontend:serve backend:serve または gulp debug を実行すると (実質的に同じであり、インデックス ファイルが再構築されません。

ポインタはありますか?ありがとう。

4

1 に答える 1