捆绑.扩展Microsoft ASP.NET Web优化框架的扩展(System.Web.Optimization)

安装命令:


Install-Package Bundling.Extensions

用法:

像往常一样注册捆绑包:


var cssBundle = new Bundle(\"~/bundles/css\");

cssBundle.Include(\"~/css/styles1.css\");

cssBundle.Include(\"~/css/styles2.css\");

// 在此处添加转换

BundleTable.Bundles.Add(cssBundle);

为了确保获得正确的内容类型,可以使用:


var cssBundle = new CssBundle(\"~/bundles/css\");

var jsBundle = new JsBundle(\"~/bundles/js\");