41
40

More than 5 years have passed since last update.

gulp-watch で、監視対象のファイルが新しく増えた場合も検知させる

Last updated at Posted at 2014-09-19

gulp に最初から内蔵されている gulp.watch() は、ファイルの変更については監視してくれるが、ファイルの新規追加や削除については監視してくれない?? (少なくとも僕の環境では、新規ファイルを作っても反応してくれなかった)

ということで、gulp-watch プラグインを使う。

gulpfile.coffee

watch = require 'gulp-watch'

gulp.task 'watch', ->
  watch 'css/**/*.scss', ->
    gulp.start 'css'

gulp.task 'css', ->
  # css のコンパイルを行う

gulp-watch プラグインでは、監視対象となるファイルが新しく増えた場合などでも反応してくれた。

にしても、色々ググってたけど "gulp.watch()" と "gulp-watchプラグイン" が別物とはなかなか気づけず、ちょっとハマった…

41
40
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
41
40