1.在App_Start文件夹中BundleConfig.cs类中添加相应的文件
1.1bundles.Add(new ScriptBundle("~/bundles/adminJs").Include("~/Scripts/jquery.js", "~/Scripts/jquery.form.js"));
1.2bundles.Add(new StyleBundle("~/Content/adminCss").Include("~/Content/base.css", "~/Content/right.css", "~/Content/validation.css"));
2.在Global.asax文件中开启压缩文件操作
BundleTable.EnableOptimizations = true; //启用这一行,则使用Bundle的机制进行文件打包
3.在相应的VIEW调用即可
@Scripts.Render("~/bundles/validate")
时间: 2024-12-12 12:28:19