Nate Nate - 1 year ago 197
Less Question

Less bundle is throwing a StackOverflow exception

I'm trying to bundle some .less files in VS 2012. I have installed the BundleTransformer which also installs dotless.

Here's my BundleConfig.cs

using System.Web;
using System.Web.Optimization;
using BundleTransformer.Core.Orderers;
using BundleTransformer.Core.Transformers;

namespace TrainerRoad.Web
public class BundleConfig
public static void RegisterBundles(BundleCollection bundles)
var cssTransformer = new CssTransformer();
var jsTransformer = new JsTransformer();
var nullOrderer = new NullOrderer();

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(

// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(

var lessBundle = new StyleBundle("~/bundles/css").Include(

lessBundle.Orderer = nullOrderer;



When I add


To my head section I get

An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll

I've tried making it just a Bundle instead of a StyleBundle and that didn't help either. I can hit the less files directly and they serve up correcting (that uses the bundle transformer). I've also tried specifying each file instead of using the *.less syntax.

How do I bundle these LESS files correctly?

Answer Source

You could change the bondule and instead load the LESS files load the CSS files generated by the Web Essentials you can configuire the CSS compilation.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download