Hi I'm using this filter
var fs = require('fs');
function onlyNew(target) {
return function(filepath) {
var src = fs.statSync(filepath).mtime.getTime();
var dest = grunt.config(target.concat('dest')) +
filepath.slice(grunt.config(target.concat('cwd')).length);
dest = fs.statSync(dest).mtime.getTime();
return src > dest;
}
};
in the following call to grunt-contrib-copy
copy: {
all: {
src: 'mysource/reset.html',
dest: 'mydest/reset.html',
filter: onlyNew(['copy', 'all'])
},
},
This works great and only copies when the source file is newer than the destination. However how do I temporarily disable those filters to force a copy.
I attempted making the `onlyNew`` filter as such:
function onlyNew(target) {
if (grunt.option('forceCopy'))
return true;
else {
return function(filepath) {
var src = fs.statSync(filepath).mtime.getTime();
var dest = grunt.config(target.concat('dest')) +
filepath.slice(grunt.config(target.concat('cwd')).length);
dest = fs.statSync(dest).mtime.getTime();
return src > dest;
}
}
};
However running grunt --forceCopy
is having no effect
Don't understand this, but my logic was inverted, this works: