Bundling with Sitecore 6.5 to 8.2 + versions of Sitecore

Asp.net MVC4 bundling and minification it helps to avoid the repeated request to Servers and enables caching the data into server Memory.

I have got a chance to implement bundling in two Sitecore Versions

  • Sitecore 6.5 (Web Forms)
  • Sitecore 8.1 (MVC)

Let’s See how to implement bundling in Sitecore 6.5

Bundling in Sitecore 6.5 to  8.1 version

1)Open NuGet packet manager and execute the below command

2)Create a Class and add the .css file and .js file path as like below

3)Open Global.asax.cs file and open Application Start Event and add your bundling class

4)add the Script bundle and style bundle into the IgnoreUrlPrefixes as like below

5) Now remove the actual reference of your css &js files inside the code and add the below code to refer the files

Below is the reference in case of Web forms

 Bundling in Sitecore 8.2 and greater version

Sitecore removed the functionality of Global.asax.cs Application_Start event from Sitecore 8.2 onwards because its Inheriting Sitecore.Web.Application.  So we need to use the sitecore pipeline approach as per the blog post as below.

I already implemented asp.net bundling using Sitecore Pipeline as per the below blog post , its working absolutely fine