admin管理员组

文章数量:1391934

I have problem with asp 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 pressor?

I have problem with asp 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 pressor?

Share Improve this question edited Sep 4, 2013 at 10:51 dado89 asked Sep 4, 2013 at 10:45 dado89dado89 781 silver badge7 bronze badges 2
  • Have you looked at or used nuget/packages/YUICompressor.NET? I'm not aware of the ASP.NET bundling including obfuscation. – MikeSmithDev Commented Sep 4, 2013 at 14:10
  • I used it in earlier versions of MVC, but I believed that I won't need it anymore with asp MVC 4 where bundling and minification was presented, looks like I was wrong, I found solution now in nuget/packages/BundleTransformer.Yui/1.8.0 – dado89 Commented Sep 6, 2013 at 11:55
Add a ment  | 

3 Answers 3

Reset to default 3

Actually I installed this nuget package https://www.nuget/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 reend: http://www.nuget/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.

本文标签: javascriptASPNET MVC 4 bundles minification OK but there is NO obfuscationStack Overflow