Domanda

After reading from http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification :

The bundling framework follows several common conventions such as: Selecting “.min” file for release when “FileX.min.js” and “FileX.js” exist. Selecting the non “.min” version for debug. [..]"

But : even though my js files are not all minified in the solution, I still receive a minified version in the web browser when BundleTable.EnableOptimizations = true.

My questions is : Why should I manually minify my JS files when the BundleTable.EnableOptimizations = true option take care of it ?

È stato utile?

Soluzione

There's typically no reason to. Occasionally, I've seen certain scripts choke after being minimized automatically, and in those cases, it might be beneficial to use the minified version provided by the developer. Otherwise, it doesn't matter.

Also, you don't need to set BundleTable.EnableOptimizations = true. That's merely to force minification and bundling in development, which you should not do unless you're explicitly testing the bundling and minification itself. Otherwise, leave the setting alone. In development, you'll get all the scripts separately so you can debug easily, and in production, they will automatically be bundled.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top