Using dotLess in .Net

While I had a node.js system built to build my LESS stylesheets and even a less.js client-side generator I found that the client-side doesn’t work quick enough on firefox and even the server side isn’t the simplest thing when you are working with .Net and end up having the feel you have two parallel systems.

So I searched for more options and decided to give another try to dotLess, which gives .Net a handler to use .less files and generate the CSS server-side.

Installing dotLess

First of all, install dotLess through NuGet:
PM> Install-Package dotless

That will install the library, add its references and make some changes in the webconfig, unfortunately looks like IIS7 doesn’t like one of those changes:

This is because IIS 7 uses http handlers from both <system.web><httpHandlers> and <system.webServer><handlers>. […]

Found on stackoverflow answering something different but works, all I had to do is remove/comment the handler added inside system.web leaving the other one and… voilà! it works.

Pros and cons of this approach

Pros: To have LESS running in your .Net app in no time!
Cons: I’ve had problems compiling some LESS files due to advanced syntax I’m using that dotLess can’t handle, also, you need to “build” your app each time you make any change on your styles as it’s caching it, there’s maybe a way to avoid caching though.