Yes, that's correct if you only want to concatenate and minify all .js
files in the scripts
directory one level deep.
For example, if scripts/
contains a.js
and b.js
and the foo/
directory, you'd get the concatenation and minified result of a.js
+ b.js
but nothing in the foo/
directory.
What if you want to get everything in the foo/
directory (and all other nested directories) as well? Change the expression from ['scripts/*.js']
to ['scripts/**/*.js']
-- or any minimatch expression:
https://github.com/gruntjs/grunt/blob/master/docs/api_file.md#gruntfileexpand
You're able to use any minimatch expression since the grunt min
task uses the expandFiles
function:
https://github.com/gruntjs/grunt/blob/master/tasks/min.js#L21
The downside to using a minimatch expression with this task is it's hard to understand what order the files will be concatenated in, which is often very important. Be careful if this matters.
Also, please note that a new version of grunt (0.4
) is coming out very soon. This will make this answer obsolete, as the min
task has been changed in 0.4
(but will still support minimatch expression).