tschaub / grunt-newer

Configure Grunt tasks to run with newer files only.
https://npmjs.org/package/grunt-newer
MIT License
945 stars 53 forks source link

newer not working with coffee watch #30

Closed jsbalrog closed 10 years ago

jsbalrog commented 10 years ago

I have a watch for building coffeescript files, and the relevant parts of my Gruntfile look like this:

    var coffeeFiles = 'public/javascripts/**/*.coffee';
    grunt.initConfig({
        coffee: {
          all: {
            expand: true,
            src: coffeeFiles,
            ext: '.js'
          }
        },
        watch: {
          options: {
            nospawn: true
          },
          all: {
            files: coffeeFiles,
            tasks: ['newer:coffee:all'],
            options: {
              livereload: true
            }
        }
    });

The first time I change a coffeescript file, the watch compiles ALL coffeescript files. Subsequent changes will compile just the changed file.

tschaub commented 10 years ago

Can you describe a bit more about what you expect to happen?

Subsequent changes will compile just the changed file.

This is how grunt-newer is supposed to work (when dealing with 1:1 src:dest mappings). The first time you run, if no dest files exist, all src files will be used. On subsequent runs, only those src files that are newer than corresponding dest files will be used.

tschaub commented 10 years ago

Please reopen if you can provide more detail on what you think is going wrong. From what you describe above, it sounds like the newer task is working as expected.