我正在尝试使用新的.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>
标签,而不是<style>
标签:<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() %>
语法来渲染脚本捆绑?