I am trying to concatenate all js files in the root and in any other folders of my app, but ignore any files in the node_modules
folder. For some reason this setup still takes the node modules, too:
concat: {
dist: {
src: ['*.js', '**/*.js', '!node_modules/*.js'],
dest: 'concat.js'
}
},
Thanks so much
To negate matching the whole node_modules
directory use this glob pattern:
'!node_modules/**/*.js'
Gruntfile.js
too, in which case you can include multiple !
negation patterns.concat.js
is being written to the projects root directory, you'll need to negate that too to exclude that on subsequent runs of the task.For example:
concat: {
dist: {
src: ['*.js', '**/*.js', '!node_modules/**/*.js', '!Gruntfile.js', '!concat.js'],
dest: 'concat.js'
}
},