1

I am using the latest BundleTransformer for ASP.NET.

I have an extremely simple bundle file with one LESS file:

 var cssBundle = new CustomStyleBundle("~/Content/css/bundle").Include(                                              
                                       "~/Content/css/test.less");
 bundles.Add(cssBundle);

The LESS file I've made as simple as possible to prove it is actually correctly interpreting as LESS.

.something
{
    ol, ul
    {
        list-style: none;
    }
}

When I try to use V8JsEngine it works as expected (relevant web.config shown):

<css defaultMinifier="KryzhanovskyCssMinifier" usePreMinifiedFiles="false">
    <minifiers>
         <add name="KryzhanovskyCssMinifier" type="BundleTransformer.Csso.Minifiers.KryzhanovskyCssMinifier, BundleTransformer.Csso" />
    </minifiers>
</css>

<csso>
  <css disableRestructuring="false" />
  <jsEngine name="V8JsEngine" />
</csso>

This gives me the correct CSS:

.something ol,.something ul{list-style:none}

However when I switch to MsieJSEngine

<csso>
  <css disableRestructuring="false" />
  <jsEngine name="MsieJsEngine" />
</csso>

I get the following bizarrely incorrect CSS - with UL completely stripped out.

.something ol{list-style:none}

I just can't quite fathom how this is even possible. It has been interpreted correctly as LESS, but completely stripped out the UL from the list. Incidentally if I make it just a pure css file without the .something class I get the same incorrect result.

Fortunately it seems to work fine with V8JsEngine so I can keep on, but I'm posting this here hopefully to help others and because I'm very curious if there's something I did wrong.


File versions:

BundleTransformer.Core - 1.9.3.0
BundleTransformer.Csso - 1.9.1.0
BundleTransformer.Less - 1.9.1.0
BundleTransformer.MicrosoftAjax - 1.9.1.0
Simon_Weaver
  • 140,023
  • 84
  • 646
  • 689
  • I'm in the same situation. Were you able to find a solution to this problem? – vitaly-t Aug 19 '14 at 11:36
  • Only switching to the V8 engine – Simon_Weaver Aug 20 '14 at 01:17
  • I did the same and it works, which is quite annoying. I had to install VC++ 2012 Redistributable Package on the IIS because it is required by V8JsEngine. I find that CSS+JS packaging is the biggest pain in the ass when it comes to entire MVC, they always break with updates. – vitaly-t Aug 22 '14 at 10:37

1 Answers1

1

For BundleTransformer.Csso need the full support of ECMAScript 5, that is implemented only in ChakraJsRt mode of the MSIE JavaScript Engine for .NET. Quote from the documentation:

JsRT version of Chakra JavaScript engine (supports ECMAScript 5). Requires Internet Explorer 11 or higher on the machine.

Incidentally, in description of the BundleTransformer.Csso NuGet-package has the following requirement:

For correct working of this module is recommended to install the following NuGet packages: JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.Msie (only in the ChakraJsRt mode).

Andrey Taritsyn
  • 1,286
  • 11
  • 26
  • Starting with version [1.5.4](https://github.com/Taritsyn/MsieJavaScriptEngine/releases/tag/v1.5.4) in `ChakraActiveScript` mode added native support of ECMAScript 5 (without polyfills). In version [1.6.0](https://github.com/Taritsyn/MsieJavaScriptEngine/releases/tag/v1.6.0) `ChakraJsRt` was divided into 2 modes: `ChakraIeJsRt` and `ChakraEdgeJsRt`. – Andrey Taritsyn Dec 09 '15 at 13:30