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

推荐订阅源

Jina AI
Jina AI
V
Vulnerabilities – Threatpost
Security Latest
Security Latest
AI
AI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
H
Help Net Security
Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
L
LINUX DO - 最新话题
A
Arctic Wolf
博客园_首页
S
Securelist
S
Secure Thoughts
Google DeepMind News
Google DeepMind News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
酷 壳 – CoolShell
酷 壳 – CoolShell
Stack Overflow Blog
Stack Overflow Blog
N
Netflix TechBlog - Medium
Cyberwarzone
Cyberwarzone
小众软件
小众软件
T
Threatpost
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Blog — PlanetScale
Blog — PlanetScale
N
News and Events Feed by Topic
NISL@THU
NISL@THU
Forbes - Security
Forbes - Security
博客园 - 聂微东
F
Fortinet All Blogs
Simon Willison's Weblog
Simon Willison's Weblog
H
Heimdal Security Blog
罗磊的独立博客
S
Security @ Cisco Blogs
B
Blog
T
Troy Hunt's Blog
Engineering at Meta
Engineering at Meta
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The Hacker News
The Hacker News
The Last Watchdog
The Last Watchdog
Hacker News - Newest:
Hacker News - Newest: "LLM"
I
Intezer
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
The Cloudflare Blog
S
Schneier on Security
月光博客
月光博客
L
LINUX DO - 热门话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

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