我已经使用 System.Web.Optimization & WebGrease DLL 使用以下代码在我的项目中自动捆绑和缩小 javascript 和 css 文件。
using System.Web.Optimization;
using WebGrease;
protected void Application_Start()
{
RegisterBundles(BundleTable.Bundles);
BundleTable.EnableOptimizations = false;
}
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/Content/Script/Common/").Include("~/Content/Scripts/PTax/Common/ViewPort.js",
"~/Content/Scripts/PTax/Common/jquery.rotate.js",
"~/Content/Scripts/PTax/Common/jquery.loupe.js",
"~/Content/Scripts/PTax/Common/Accordion.js",
"~/Content/Scripts/PTax/Common/Progress.js",
"~/Content/Scripts/PTax/Common/AjaxGlobalHandler.js",
"~/Content/Scripts/PTax/Common/DialogBox.js",
"~/Content/Scripts/PTax/Common/Common.js",
"~/Content/Scripts/PTax/Common/DateValidations.js"));
}
在我的项目中,某个模块只有一个 javascript 文件。我不需要将它与任何其他文件捆绑在一起。所以我只需要它缩小它。我怎样才能做到这一点。