Grunt option when you want to process multiple files in a directory
Most grunt modules that work with files have a
files
property where you can set which files it would act upon:
dev: {
files: {
'dist/index.html': 'src/index.html',
'dist/contact.html': 'src/contact.html'
}
}
If you want to be able to process any file in any directory you can use this format:
dev: {
files: [{
expand: true,
cwd: 'src',
src: '**/*.html',
dest: 'dist/'
}]
}
The code above processes all the pages placed in the “src” directory and
its subfolders.The way I used it with the grunt email workflow:
// Minifies html
module.exports = {
dist: {
options: {
removeComments: true,
collapseWhitespace: true,
minifyCSS: true
},
files: [{
expand: true,
cwd: '<%= paths.dist %>',
src: '**/*.html',
dest: '<%= paths.dist %>/'
}]
}
};
Source: http://www.sitepoint.com/5-grunt-tasks-improve-performance-website/