8

私は gruntjs が初めてで、これが私の単純な gruntfile です。

/* global module:false */
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    watch: {
      tasks: 'coffee'
    },
    coffee: {
      compile: {
        files: {
          'js/javascript/*.js': ['js/coffeescript/*.coffee'] // 1:1 compile
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-coffee');

  // Default task.
  grunt.registerTask('default', 'coffee');
};

grunt を実行すると、正常にコンパイルされます。ただし、grunt watch を実行すると、待機しているだけで、変更が検出されません。

4

1 に答える 1

12

監視するファイルを追加する必要があります。

watch: {
  coffee: {
    files: ['js/coffeescript/*.coffee'],
    tasks: 'coffee'
  }
}

から

于 2012-10-10T09:13:48.113 に答える