View Single Post
  #2 (permalink)  
Old February 17th, 2014, 06:19 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,960
Thanks: 79
Thanked 1,559 Times in 1,536 Posts
Default

Hi Alan,

Here's what I have on bundling in the upcoming update for ASP.NET 4.5.1:

1. Run the following package command:

Code:
Install-Package Microsoft.AspNet.Web.Optimization.WebForms
2. Open up your Global.asax file and at the top of the file, below the Import statement for the System.Net.Mail namespace, add the following Import statement:

Code:
<%@ Import Namespace="System.Web.Optimization" %>
3. In the Application_Start event handler in the same file, add the following code below the line that creates the ScriptResourceDefinition.

Code:
VB.NET
BundleTable.Bundles.Add(New StyleBundle("~/StyleSheets").
IncludeDirectory("~/Styles", "*.css"))
C#
BundleTable.Bundles.Add(new StyleBundle("~/StyleSheets").
IncludeDirectory("~/Styles", "*.css"));
4. Open the Frontend master page and right before the closing <head> tag add the following code:
Code:
<webopt:bundlereference runat="server" path="~/StyleSheets" />
</head>
Hope this works for you too.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote