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

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Ranran

ASP.NET 5与MVC 6中的新特性 .NET技术大系概览 (迄今为止最全的.NET技术栈) 7 天玩转 ASP.NET MVC — 第 1 天 腾讯web前端笔试题及个人答案 - Ranran 11个Visual Studio代码性能分析工具 高效的使用 Response.Redirect CLR 这些年有啥变化吗? ASP.NET 大文件下载的实现思路及代码 7个Linux和Ubuntu下的免费CSS编辑器 11个很棒的 jQuery 图表库 - Ranran 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文件不起作用的原因了。