grunt-newer icon indicating copy to clipboard operation
grunt-newer copied to clipboard

New files added to src are not detected

Open startswithaj opened this issue 10 years ago • 5 comments

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?

startswithaj avatar Mar 25 '15 03:03 startswithaj

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.

jkudish avatar Mar 25 '15 06:03 jkudish

bump

OwenMelbz avatar Nov 10 '15 11:11 OwenMelbz

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.

tschaub avatar Nov 10 '15 16:11 tschaub

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.

LeeJim avatar Aug 11 '16 06:08 LeeJim

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

mzentrale-htschurl avatar May 05 '17 09:05 mzentrale-htschurl