- 软件包
System.Web.Optimization
已安装 捆绑包已配置如下
using System.Web.Optimization; public class BundleConfig { public static void RegisterBundles(BundleCollection bundles) { bundles.Add(new ScriptBundle("~/Content/themes/base/js").Include("~/Scripts/Site.js")); bundles.Add(new StyleBundle("~/Content/themes/base/css").Include("~/Content/Site.css")); } }
将此添加到 Layout.cshtml
@System.Web.Optimization.Scripts.Render("~/Content/themes/base/js") @System.Web.Optimization.Styles.Render("~/Content/themes/base/css")
css 缩小成功但 js 文件返回 404 错误?