Reputation: 3630
Is there a way by which we can exclude the folder root when you are compressing all files within a folder?
grunt.initConfig({
compress: {
main: {
files: [
{expand: true, src: ['dist/**', 'xyz/**']},
]
}
}
});
How can we exclude dist and xyz folders from being included in the compressed file?
Thanks,
Paddy
Upvotes: 1
Views: 3726
Reputation: 4129
If your want the files under the folder included, you need to change the cwd
for each target so that they are treated as the root for each glob pattern
grunt.initConfig({ compress: { main: { files: [ {cwd: 'dist/', expand: true, src: ['**']}, {cwd: 'xyz/', expand: true, src: ['**']}, ] } } });
If you are looking just exclude the folders in the root, then use !
patterns that Kyle mentioned
Upvotes: 6
Reputation: 13762
Prepending a !
will negate a pattern:
{expand: true, src: ['dist/**', '!xyz/**']}
See: http://gruntjs.com/configuring-tasks#globbing-patterns
Upvotes: 6