Grunt Uglify - ignore specific files / folders

When starting uglify, I need to make it ignore certain files and folders, but recursively scan the entire folder structure.

I have a concat task that combines all my plugins and makes them one file. I need to make sure that uglify ignores these files and does not work on them, because I do not want them in the destination directory, since concat has already processed this for me.

I tried adding files and folders to my src array using the previous ones !, but it still works on them.

Below I try to use, but it does not work:

uglify: { options: { banner: '/*! <%= grunt.template.today("mm-dd-yyyy h:MM:ss TT") %> */\n' }, files: { src: [ '!ie' ,'!polyfills' ,'!vendor' ,'!iecompat.js' ,'**/*.js' ], dest: 'app/scripts', cwd: 'sources/scripts', ext: ".js", flatten: false, expand: true } }, 
+7
gruntjs grunt-contrib-uglify
source share
2 answers

Ilan Frumer's suggestion is probably good.

Now, about your specific question, your templates should certainly be adapted as follows:

Example:

  '!**/ie/*' 

will ignore any file in a folder named "ie" anywhere in your subdirectories (which, most likely, do you want it right?)

The same goes for:

  '!**/iecompat.js' 

which will ignore a file called iecompat.js anywhere in folders / subfolders.

You should start here to better understand the file selection mechanisms in grunt.

+7
source share

The above answer did not work for me because it is (as far as I can tell) a search for a subfolder, not a subfolder.

This is what worked for me:

 '!ie/**' 
+1
source share

All Articles