How to ignore files grunt uglify

Solution 1:

To the end of the src array, add

'!docroot/js/main.min.js'

This will exclude it. The ! turns it into an exclude.

http://gruntjs.com/api/grunt.file#grunt.file.expand

Paths matching patterns that begin with ! will be excluded from the returned array. Patterns are processed in order, so inclusion and exclusion order is significant.

This is not specific to grunt uglify, but any task that uses grunt convention for specifying files will work this way.

As a general advice though I would suggest putting built files somewhere else than your source files. Like in a root dist folder.