Talking about the Js/css packing compression function of MVC 4 in asp.net-practical skills

Source: Internet
Author: User

Today in the use of MVC4 packaging compression function @scripts.render ("~/bundles/jquery") when some confusion, asked what in the App_start folder under BundleConfig.cs file

Bundles. ADD (New Scriptbundle ("~/bundles/jquery"). Include ( 
            "~/scripts/jquery-{version}.js", 
            "~/scripts/jquery.unobtrusive-ajax.js" 
            )); 

It's okay to write, but

Bundles. ADD (New Scriptbundle ("~/bundles/jquery"). Include ( 
            "~/scripts/jquery-{version}.js", 
            "~/scripts/jquery.unobtrusive-ajax.min.js" 
            )); 

It's not possible to write it, but I have it in my catalogue.

"~/scripts/jquery.unobtrusive-ajax.min.js" 

This file.

By debugging the trace found that the ". Min.js" file has been filtered within MVC

By decompile This DLL file

You can see the following decompile code:

public static void Adddefaultignorepatterns (Ignorelist ignorelist) 
{ 
  if (ignorelist = = null) 
  { 
    throw New ArgumentNullException ("Ignorelist"); 
  } 
  Ignorelist.ignore ("*.intellisense.js"); 
  Ignorelist.ignore ("*-vsdoc.js"); 
  Ignorelist.ignore ("*.debug.js", optimizationmode.whenenabled); 
  Ignorelist.ignore ("*.min.js", optimizationmode.whendisabled); 
  Ignorelist.ignore ("*.min.css", optimizationmode.whendisabled); 
} 

This allows us to know that MVC defaults to filtering out the files for suffix. intellisense.js,-vsdoc.js,. debug.js,. Min.js,. Min.css, which is why we're referencing the. min.js file does not work.

The above mentioned is the entire content of this article, I hope you can enjoy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.