【发布时间】:2014-06-10 00:56:27
【问题描述】:
我读了关于bundling and monification的文章,特别是关于使用CDN的文章,但有些事情我不清楚。
举个例子:
public static void RegisterBundles(BundleCollection bundles)
{
//bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
// "~/Scripts/jquery-{version}.js"));
bundles.UseCdn = true; //enable CDN support
//add link to jquery on the CDN
var jqueryCdnPath =
"http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js";
bundles.Add(new ScriptBundle("~/bundles/jquery",
jqueryCdnPath).Include(
"~/Scripts/jquery-{version}.js"));
// Code removed for clarity.
}
是否可以使用
{version}格式的 CDN 引用,例如“本地”引用?在捆绑包中包含已经缩小的脚本版本有什么意义,例如 jquery-1.7.1.min.js?如果它不存在怎么办?如果
.min文件存在和/或分别生成它,它不应该搜索吗?
【问题讨论】:
标签: c# jquery .net asp.net-mvc asp.net-mvc-4