简体   繁体   中英

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

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?

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

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/

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM