.Net Bundling and Minification
I like to use the bundling and minification that comes out of the box with .Net, as i figure why use another tool when i’ve got something already there.
A gotcha i’ve found with this is that the minification in this library is a bit flakey and fails with certain tags (e.g. using “@import” in a css file). If the minification fails it does it silently, and just returns the unminified content of the file.
To check if you have any minification errors you need to use the dev tools in your browser, and look at the Response of all your minified bundles.
If minification is failing you will see something like this:
/* Minification failed. Returning unminified contents.
(87,442-449): run-time error JS1019: Can’t have ‘break’ outside of loop: break n
*/
if you see this, scroll down through the contents. The javascript/css that could minify will be minified, the rest will not be. So you can pinpoint the culprit that way.
You’ll probably have to use pre-minified files for this if it’s a third party dependency, or modify your javascript if it’s one of your own.