gruntjs/grunt — pull request #1202 by jpommerening (2014-08-22 07:44:21+00:00)
Title: Add missing filtering of task `src` files

The documentation [mentions](http://gruntjs.com/configuring-tasks#custom-filter-function) that one can filter the source files with a custom filter function. After some failed attempts at using that feature I had a look at the source and noticed the filter feature works only in some cases (compact & files array).

I've added some tests for the filter-thing and made it work for the following file configurations:

```js
// Compact (http://gruntjs.com/configuring-tasks#compact-format)
target1: {
dest: 'dist/file1.js',
src: [ 'one/**/*.js' ],
filter: filterFn
},
// Files object (http://gruntjs.com/configuring-tasks#files-object-format)
target2: {
files: {
'dist/file1.js': [ 'one/**/*.js' ],
'dist/file2.js': [ 'two/**/*.js' ]
},
filter: filterFn
},
// Files array (http://gruntjs.com/configuring-tasks#files-array-format)
target3: {
files: [
{ dest: 'dist/file1.js', src: [ 'one/**/*.js' ], filter: filterFn },
{ dest: 'dist/file2.js', src: [ 'two/**/*.js' ], filter: filterFn }
]
},
// Files objects in array (undocumented?)
target4: {
files: [
{ 'dist/file1.js': [ 'one/**/*.js' ] },
{ 'dist/file2.js': [ 'two/**/*.js' ] }
],
filter: filterFn
},
```

Note that the resulting files object does not contain the `filter` property (but `.orig` does).