grunt-update-json
grunt-update-json copied to clipboard
Pass current file to modifying function
It would be nice to be able to access the source path and destination path of the currently modified JSON. It seems currently not possible if you use globbing. Here is an example of what should be possible:
update_json: {
foo: {
files: [{
expand: true,
src: 'src/**/*.foo',
dest: 'dst/',
ext: '.bar',
}],
fields: {
x: function(j, src, dst){
return j.x = 'From '+src+' to '+dst;
}
}
},
}