0

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(
                        "~/Scripts/jquery-{version}.js"));

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

            var lessBundle = new StyleBundle("~/bundles/css").Include(
                "~/assets/css/*.less");

            lessBundle.Transforms.Add(cssTransformer);
            lessBundle.Orderer = nullOrderer;

            bundles.Add(lessBundle);

        }
    }
}

When I add

@Styles.Render("~/bundles/css")

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?

4

2 回答 2

1

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.

于 2013-07-12T20:00:45.610 回答
0

BundleTransformer.Less will not work without a Internet Explorer 9 or above. This error will occur when executing a large amount of JS code, i.e. most part of the Bundle Transformer modules will cause this error.

于 2016-09-24T10:04:19.953 回答