Newer task and src property
This is the unmodified jshint task from my Gruntfile
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: [
'Gruntfile.js',
'<%= yeoman.app %>/scripts/{,*/}*.js'
],
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
Compare
grunt newer:jshint:test
and
grunt newer:jshint:all
The first one works correctly and doesn't execute jshint:test when there's no changes since the last successful run (As per documentation here: https://www.npmjs.org/package/grunt-newer). So I get "No new files to process" in my console when I run it multiple times without any changes to src files.
The second command doesn't behave in the same way and it looks like newer task needs 'src' property to be set explicitly in jshint:all configuration. This seems to be working fine for me:
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: ['Gruntfile.js', '<%= yeoman.app %>/scripts/{,*/}*.js']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/spec/{,*/}*.js']
}
},
Also check 'Known limitations' at the bottom of https://www.npmjs.org/package/grunt-newer. It kind of says that 'src' is needed for newer task to work correctly. Other src-dest file mapping formats might not be supported.
@lucasprus feel free to submit a pr for this
fixed in https://github.com/yeoman/generator-angular/commit/1c37e2d0691530ab4fa7a730e00acebd12566955
check this out https://github.com/gruntjs/grunt-contrib-watch#compiling-files-as-needed js: { files: ['<%= yeoman.app %>/scripts/{,/}.js'], tasks: ['newer:jshint:all'], options: { livereload: '<%= connect.options.livereload %>', spawn: false, //i think need this } }, in my yo angular environment helped because, newer:jshint:all run very very slow, (i dont know why), about 10sec, with spawn:false run 0.09s