ASP.NET MVC 4 bundles minification OK but there is NO obfuscation

5.5k views Asked by At

I have problem with asp.net MVC4 javascript bundles. All is working and it's OK, but js code is only minimized and NOT obfuscated. Is there anything I can do in .NET, or should I get back to my own bundling and minification system based on YUI compressor?

3

There are 3 answers

1
dado89 On BEST ANSWER

Actually I installed this nuget package https://www.nuget.org/packages/BundleTransformer.Yui/1.8.0 Works excellent. Saved me some time.

1
Damjan On

In file App_Start\BundleConfig method RegisterBundles at the end add the following code:

BundleTable.EnableOptimizations = true;

Also make sure that bundling and minimizations are not disabled from the configuration file.

0
David Graça On

Here is some explanation about bundling and minification in some quick notes.

Bundling picks all the scripts/css files and puts them in a single file to make less HTTP requests when loading a page.

Minification deletes all useless characters like: spaces, newlines, etc. to decrease file size.

Obfuscation pick the readable css or js files and makes it unreadable for the human eye making it more difficult to copy.

So for obfuscation in .Net i recomend: http://www.nuget.org/packages/BundleTransformer.UglifyJs/