我正在创建一个asp.net webforms应用程序,并试图缩小我的js+css文件。我使用的是这些指导原则:http://blogs.msdn.com/b/rickandy/archive/2012/08/14/adding-bundling-and-minification-to-web-forms.aspx。
我的was应用程序的目标是.net 4.0,但我将其更改为.net 4.5。当我在sources选项卡中查看chrome developertoolssection部分,并在bundles下查看时,它看起来并不像是生成的:
jquery?v=我添加了BundleConfig类:
public class BundleConfig
{
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include("~/jscripts/jquery-{version}.js"));
BundleTable.EnableOptimizations = true;
}
}在jscripts文件夹中,我得到了我的js文件: jquery-1.8.0.min.js,在主页的主页上,我有:
<asp:PlaceHolder ID="PlaceHolder1" runat="server">
<%: Scripts.Render("~/bundles/jquery") %>
</asp:PlaceHolder>在母版页后面的代码OnInit-event中我有:
BundleConfig.RegisterBundles(BundleTable.Bundles);当我调试应用程序时,它命中renderstatement。是不是我需要在不同的类中注册包?
发布于 2013-11-13 01:02:00
要在调试模式下查看缩小版本,您可以执行以下操作:
中
https://stackoverflow.com/questions/19170600
复制相似问题