BundleConfig是VS 2013中的新功能,
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
/// <summary>
/// 在開發時
/// 設定web.config=> compilation debug="true" 可直接使用.js 檔作開發,
///
/// 在發佈時
/// 設定web.config=> compilation debug="false" 在發佈於正式網站後,.js .css 系統會自動壓縮,並加密。(*.js=> *.mm.js)
/// </summary>
/// <param name="bundles"></param>
public static void RegisterBundles(BundleCollection bundles)
{
#region 放在layout中,所有網頁可共用的js
//jquery.unobtrusive-ajax.js
//js-程式庫
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
//js -UI元件
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
//js -ajax元件 MVC5預設不安裝 ,新增網站需要安裝
//http://blog.miniasp.com/post/2014/11/10/ASPNET-MVC-5-Microsoft-jQuery-Unobtrusive-Ajax-lost-and-found.aspx
bundles.Add(new ScriptBundle("~/bundles/jqueryajax").Include(
"~/Scripts/jquery.unobtrusive-ajax*"));
//套JavaScript UI程式庫,主要用來在網頁實現MVVM設計模式
//http://blog.darkthread.net/post-2012-05-09-knockout-js-intro.aspx
bundles.Add(new ScriptBundle("~/bundles/knockout").Include(
"~/Scripts/knockout-{version}.debug.js"));
#endregion
#region 單一網頁include
//js-表單驗證才需載入
//Scripts\jquery.validate.unobtrusive.js
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
#endregion
#region aps.net 預設/css
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
#endregion
}
}
沒有留言:
張貼留言