This project has moved and is read-only. For the latest updates, please go here.

Correct way to minify a LESS transform

Apr 15, 2013 at 7:02 PM
Hi Andrey,

Great work on the package! I read on the following blog it is not advised to use the built-in CssMinify() method when dealing with a LESS bundle (I am using the bootstrap LESS files)

I installed the MicrosoftAjax transformer to use its minify method but I cannot find a method that implements IBundleTransform, e.g. my code:

lessBundle.Transforms.Add(new BundleTransformer.MicrosoftAjax.Minifiers.MicrosoftAjaxCssMinifier());

Argument 1: cannot convert from 'BundleTransformer.MicrosoftAjax.Minifiers.MicrosoftAjaxCssMinifier' to 'System.Web.Optimization.IBundleTransform'

Am I missing something? (NB using the built in CssMinify() seems to work OK but I have noted it could result in unpredictable behaviour. Thanks!
Apr 16, 2013 at 8:55 AM
Edited Apr 16, 2013 at 8:57 AM
Hello, Barnakles!

Instances of the MicrosoftAjaxCssMinifier and MicrosoftAjaxJsMinifier classes, like other minifier-adapters, do not need to be plugging in this way. It is enough only to register instances of the CssTransformer and JsTransformer classes, and then in the Web.config file to specify the minifier, which will be used as the default minifier. To learn how to do this you can be read in the readme.txt file or in the relevant chapter of documentation.
Apr 16, 2013 at 9:09 PM
Thanks Andrey that worked.