タグ

ブックマーク / qiita.com/orangemittoo (1)

  • grunt-contrib-watchで変更されたファイルを取得する方法 - Qiita

    grunt.event.on('watch', fn)で「watch」イベントを監視し、変更したファイルを取得することができる。 イベントハンドラでは変更ファイルのパスが取得できるので、 それを使用してconfigを書き換えて、変更ファイルのみにタスクを実行させる、ということができる。 ※jshintの他にもsassやcoffeescript等のコンパイルに利用できそう。 grunt-contrib-watchのconfigでnospawn: trueにしないとイベントハンドラによるconfig書き換えが反映されない。 grunt.initConfig({ watch: { scripts: { files: ['lib/*.js'], tasks: ['jshint'], }, options: { nospawn: true } }, jshint: { all: ['lib/*.js

    grunt-contrib-watchで変更されたファイルを取得する方法 - Qiita
  • 1