惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
GRAHAM CLULEY
Hacker News - Newest:
Hacker News - Newest: "LLM"
C
Cybersecurity and Infrastructure Security Agency CISA
Simon Willison's Weblog
Simon Willison's Weblog
Latest news
Latest news
C
CERT Recently Published Vulnerability Notes
T
Threatpost
V
Vulnerabilities – Threatpost
AWS News Blog
AWS News Blog
Blog — PlanetScale
Blog — PlanetScale
C
Cisco Blogs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
U
Unit 42
The Register - Security
The Register - Security
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
The Hacker News
The Hacker News
AI
AI
Project Zero
Project Zero
Scott Helme
Scott Helme
S
Securelist
Vercel News
Vercel News
GbyAI
GbyAI
S
Security @ Cisco Blogs
I
InfoQ
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
Forbes - Security
Forbes - Security
Google Online Security Blog
Google Online Security Blog
W
WeLiveSecurity
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Heimdal Security Blog
G
Google Developers Blog
D
DataBreaches.Net
The Last Watchdog
The Last Watchdog
D
Docker
MyScale Blog
MyScale Blog
T
Tor Project blog
Cyberwarzone
Cyberwarzone
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
T
Tenable Blog
T
Threat Research - Cisco Blogs
Cisco Talos Blog
Cisco Talos Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 聂微东
月光博客
月光博客

博客园 - Ranran

ASP.NET 5与MVC 6中的新特性 .NET技术大系概览 (迄今为止最全的.NET技术栈) 7 天玩转 ASP.NET MVC — 第 1 天 腾讯web前端笔试题及个人答案 11个Visual Studio代码性能分析工具 高效的使用 Response.Redirect CLR 这些年有啥变化吗? ASP.NET 大文件下载的实现思路及代码 7个Linux和Ubuntu下的免费CSS编辑器 11个很棒的 jQuery 图表库 javascript客户端检测技术 编写更好的C#代码 ASP.NET中gridview获取当前行的索引值 .NET逻辑分层架构总结 ASP.NET 生成二维码(采用ThoughtWorks.QRCode和QrCode.Net两种方式) ASP.NET中利用DataList实现图片无缝滚动 老码农教你在 StackOverflow 上谈笑风生 ASP.NET 生成二维码(采用ThoughtWorks.QRCode和QrCode.Net两种方式) Asp.net面试题
ASP.NET MVC 4 的JS/CSS打包压缩功能-------过滤文件
Ranran · 2015-06-12 · via 博客园 - Ranran

今天在使用MVC4打包压缩功能@Scripts.Render("~/bundles/jquery") 的时候产生了一些疑惑,问什么在App_Start文件夹下BundleConfig.cs文件内

  1. bundles.Add(new ScriptBundle("~/bundles/jquery").Include(  
  2.                         "~/Scripts/jquery-{version}.js",  
  3.                         "~/Scripts/jquery.unobtrusive-ajax.js"  
  4.                         ));  

这样写可以,但是

  1. bundles.Add(new ScriptBundle("~/bundles/jquery").Include(  
  2.                         "~/Scripts/jquery-{version}.js",  
  3.                         "~/Scripts/jquery.unobtrusive-ajax.min.js"  
  4.                         ));  


这样写却不可以,我的目录里明明有

  1. "~/Scripts/jquery.unobtrusive-ajax.min.js"  

这个文件啊

通过调试跟踪发现,MVC内部已经对“.min.js”文件做了过滤


通过反编译这个DLL文件


可以看到下面反编译后的代码:

  1. public static void AddDefaultIgnorePatterns(IgnoreList ignoreList)  
  2. {  
  3.     if (ignoreList == null)  
  4.     {  
  5.         throw new ArgumentNullException("ignoreList");  
  6.     }  
  7.     ignoreList.Ignore("*.intellisense.js");  
  8.     ignoreList.Ignore("*-vsdoc.js");  
  9.     ignoreList.Ignore("*.debug.js", OptimizationMode.WhenEnabled);  
  10.     ignoreList.Ignore("*.min.js", OptimizationMode.WhenDisabled);  
  11.     ignoreList.Ignore("*.min.css", OptimizationMode.WhenDisabled);  
  12. }  

由此我们可以知道MVC默认帮我们过滤了后缀名为 .intellisense.js、-vsdoc.js、.debug.js、.min.js、.min.css的文件,这也就是我们引用.min.js文件不起作用的原因了。