Cpo Design

Implementing bundling into umbraco

Pavel Svarc Sunday, April 9, 2017 2:11 PM

While working with Umbraco, it is usefull to have comprehensive guide, how to setup css and javascript bundling behaviour in one place. 

 

Steps to implement

  1. Register umbracoReservedPaths in web.config
  2. Register Optimization
  3. Create Startup handler

 

Registration "umbracoReservedPaths"

Umbraco has reserved paths and in order to implement bundling we need to register the exception in web.config.

Nuget package Optimalization

 

In order to implement bundling, we need to have reference to System.Web.Optimalization namespace. If you do not have access to the namespace, It means that you need to add another nuget package to your solution. 

Install-Package Microsoft.AspNet.Web.Optimization

Now the namespace can be used in any of your files by adding new using as follows:

using System.Web.Optimization;

 

Implementation of StartupHandler

The last piece to implement is Start up handler as follows. The example does contain sample css and js registration sample.

Related posts

Currenlty there are no related articles.