问题
I am new to gruntjs and here is my simple 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');
};
When I run grunt it compiles fine. However, when I run grunt watch, it's just waiting and not detecting my changes.
回答1:
You should add files to watch:
watch: {
coffee: {
files: ['js/coffeescript/*.coffee'],
tasks: 'coffee'
}
}
From example
来源:https://stackoverflow.com/questions/12813514/using-gruntjs-how-do-watch-for-changes-in-coffee-files