tschaub / grunt-newer

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

New files added to src are not detected #74

Open startswithaj opened 9 years ago

startswithaj commented 9 years ago

If you have a grunt task that has a src:[] of files and you add or remove a file from this array newer does not detect this change and run the respective grunt task this occurs on version 0.8.0.

Take for example;

 uglify:
      lib:
        src:[
          'bower_components/jquery/dist/jquery.js'
          'bower_components/lodash/dist/lodash.js'
          'bower_components/localforage/dist/localforage.js'
          'bower_components/angular/angular.js'
          'bower_components/angular-animate/angular-animate.js'
          'bower_components/angular-localforage/dist/angular-localForage.js'
        ]
        dest:'app/tmp/lib.js'

if you remove one of this files so the task looks like (remove localForage):

 uglify:
      lib:
        src:[
          'bower_components/jquery/dist/jquery.js'
          'bower_components/lodash/dist/lodash.js'
          'bower_components/localforage/dist/localforage.js'
          'bower_components/angular/angular.js'
          'bower_components/angular-animate/angular-animate.js'
        ]
        dest:'app/tmp/lib.js'

and run grunt newer:uglify:lib it will say No newer files to process. I would expect it to rebuild the lib.js without the file that has been removed from the list. If you run this with the ---verbose the Files: output shows that localForgage file is not longer part of the src list but still does not initiate the task.

The same happens in reverse if for instance you add another file

 uglify:
      lib:
        src:[
          'bower_components/jquery/dist/jquery.js'
          'bower_components/lodash/dist/lodash.js'
          'bower_components/localforage/dist/localforage.js'
          'bower_components/angular/angular.js'
          'bower_components/angular-animate/angular-animate.js'
          'bower_components/angular-localforage/dist/angular-localForage.js'
          'bower_components/ng-simplePagination/simplePagination.js'
        ]
        dest:'app/tmp/lib.js'

When run with ---verbose the 'Files:' output includes simplePagination but it does not trigger the uglify task.

Am I missing something?

jkudish commented 9 years ago

I came here to report the same issue. Basically have an almost identical setup to yours @startswithaj

Let me know if I can provide anything useful from my setup.

OwenMelbz commented 8 years ago

bump

tschaub commented 8 years ago

The task works by comparing the mtime of source files to the mtime of the dest file(s). In the example you describe, none of the source files is newer than the dest file, so no work is done.

I'm not sure how you are removing one of your source files, but the way to trigger another build of the dest file would be to remove it as well.

LeeJim commented 7 years ago

i know @startswithaj 's problem.because i have the same question. if we have the source files like '/src' and the dest file '/dest', when we modify some file in '/src', the newer task run correct, but, when we add a new file in '/src', the newer task will not detected the new file change.

mzentrale-htschurl commented 7 years ago

+1, same problem. Unfortunately, this greatly limits the usefulness of grunt-newer, at least in my case :/