The ASP.NET bundling and minification framework supports frameworks like LESS but it took me some time to figure out how to use it. What’s important to understand is that although the framework supports other languages like LESS, you have to do some extra work to get this working.
One option is to add your own IBundleTransform implementation, based on the .less NuGet package:
- Add some LESS files to your web application(to improve the experience, install the Web Essentials).
- Add the .less NuGet package dotless to your project.
- Create a BundleTransform:
- Create a bundle of LESS files with the
LessTransform
and the CssMinify transform. Add the following code to theRegisterBundles
method in the App_Start\BundleConfig.cs file:
Another option is to use the System.Web.Optimization.Less library available through NuGet.