我正在尝试使用新的 .net 4.5 webforms 控件在我的母版页中呈现包。我在我的 BundleConfig.cs 中定义了一个 scriptbundle,如下所示:
bundles.Add(new ScriptBundle("~/bundles/app").Include(
"~/Scripts/underscore.js",
"~/Scripts/backbone.js",
"~/Scripts/app/app.js",
"~/Scripts/app.validator.js",
"~/Scripts/app/views/home.js",
"~/Scripts/app/views/about.js",
"~/Scripts/app/views/contact.js",
"~/Scripts/app/controls/hello.js",
"~/Scripts/app/init.js"));
然后我尝试使用新<webopt:BundleReference>
控件呈现包:
<webopt:BundleReference ID="AppBundle" runat="server" Path="~/bundles/app" />
但是当页面渲染时,输出的是<link>
标签,而不是标签:
<link href="/Scripts/underscore.js" rel="stylesheet"/>
<link href="/Scripts/backbone.js" rel="stylesheet"/>
<link href="/Scripts/app/app.js" rel="stylesheet"/>
<link href="/Scripts/app/views/home.js" rel="stylesheet"/>
<link href="/Scripts/app/views/about.js" rel="stylesheet"/>
<link href="/Scripts/app/views/contact.js" rel="stylesheet"/>
<link href="/Scripts/app/controls/hello.js" rel="stylesheet"/>
<link href="/Scripts/app/init.js" rel="stylesheet"/>
此控件是否仅用于呈现样式?还是我做错了什么?如何使用 webopt 控件而不是<%: Scripts.Render() %>
语法来呈现脚本包?