My decision is doing its job, but not really. I welcome the best answers
Basically, I map the path of the input file
if him. coffee launches the coffee compilation task
if him. * start copy task
# Watch changed files grunt.event.on 'watch', (action, filepath) -> # Determine server or client folder path = if filepath.indexOf('client') isnt -1 then 'client' else 'server' cwd = "#{path}/" filepath = filepath.replace(cwd,'') # Minimatch for coffee files if minimatch filepath, '**/*.coffee' # Compile changed file grunt.config.set('coffee', changed: expand: true cwd: cwd src: filepath dest: "#{path}-dist/" ext: '.js' ) grunt.task.run('coffee:changed') # Minimatch for all others if minimatch filepath, '**/*.!(coffee)' # Copy changed file grunt.config.set('copy', changed: files: [ expand: true cwd: cwd src: filepath dest: "#{path}-dist/" ] ) grunt.task.run("copy:changed")
source share