Turn off minify for individual files (but still combine them with others)

Nov 28, 2012 at 11:59 PM

Say I have a minified library (e.g., angular.min.js) that I wish to combine with other files in the proper order but without re-minifying it. Is there a way to simply insert this file in place and tag it (with some command-line parameter) to indicate it shouldn't be minified again?


Application: I am combining a large number of static .js files, some of which are already minified, and order is important. Angular's heavy reliance on text causes it to fail if it is minified twice (and I don't really want to minify it; I just want to insert it as-is with the glob of other things I am minifying).

Nov 29, 2012 at 3:45 PM

Nope; nothing like that is built-in. But I've done something similar before. What I ended up doing is minifying all the stuff before into one file, minifying all the stuff after into one file, then have another build step that concatenates the three files together.

But I am curious as to what causes the minification of a valid JS file to fail (even one that's already minified). That should never happen. Any chance you could elaborate on that for me? What exactly is failing when you minify angular.min.js?

Nov 29, 2012 at 4:41 PM
Edited Nov 29, 2012 at 4:51 PM

OK - I was actually using an older version of this utility (AjaxMin 4) and the error I get (when trying to minify angularjs-1.0.2.min.js) is:

AjaxMin.exe: error AM-EXCEPTION: Object reference not set to an instance of an object

I downloaded the most current version of this tool and you are correct that it does not create this exception.