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

推荐订阅源

A
About on SuperTechFans
D
DataBreaches.Net
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog RSS Feed
Recent Announcements
Recent Announcements
The Register - Security
The Register - Security
S
Secure Thoughts
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 最新话题
V2EX - 技术
V2EX - 技术
腾讯CDC
GbyAI
GbyAI
G
Google Developers Blog
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
P
Proofpoint News Feed
Schneier on Security
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
Jina AI
Jina AI
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
MyScale Blog
MyScale Blog
Help Net Security
Help Net Security
K
Kaspersky official blog
P
Privacy & Cybersecurity Law Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
AI
AI
MongoDB | Blog
MongoDB | Blog
Scott Helme
Scott Helme
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
H
Heimdal Security Blog
H
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
S
Security Affairs
TaoSecurity Blog
TaoSecurity Blog
The GitHub Blog
The GitHub Blog
Hacker News: Ask HN
Hacker News: Ask HN
Martin Fowler
Martin Fowler
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI

博客园 - 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文件不起作用的原因了。