Take the 2-minute tour ×

I'm introducing LESS into an existing ASP.NET web forms application. In order to get intellisense to work, I decided to set up the LessCssHttpHandler to intercept requests for files ending in .less.css. That way, Visual Studio still thinks we're dealing with a CSS file. I did this by adding the following line to my web.config file:

<add type="dotless.Core.LessCssHttpHandler, dotless.Core" 

In order to get this to work, I had to tweak my IIS settings so that .css files get handled by the ASP.NET framework. Unfortunately, by doing so, now my existing .css files (which aren't handled by the dotless HTTP handler since they don't end in .less.css) aren't returning any content. This makes sense since the ASP.NET framework doesn't really know what to do when it sees a file with that extension.

Is there some sort of base HTTP handler I can set up in addition to the one I have above to handle normal .cssfiles? Something like:

<add verb="*" path="*.css" type="insert some base HTTP handler here that will simply return the contents of the file" />
share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

Looks like the StaticFileHandler is what I was looking for. This is how we ended up adding it to our httpHandlers node in web.config:

<add verb="*" path="*.less.css" validate="false" type="dotless.Core.LessCssHttpHandler, dotless.Core, Version=, Culture=neutral, PublicKeyToken=96B446C9E63EAE34, processorArchitecture=MSIL" />
<add verb="*" path="*.css" type="System.Web.StaticFileHandler" />
share|improve this answer
add comment

I tend to use the console compiler and rename the less file to .css The httphandler is usually only for people who need parameters in their CSS.

share|improve this answer
add comment

We use Chirpy for our LESS support (as well as our google closure compiler support). It allows you to configure file extensions for LESS, such as .less.css, and then you can have Intellisense support.

It doesn't do translation at runtime but rather at design time within visual studio. When you edit and save the LESS file, Chirpy kicks in and processes the LESS file which generates the css file. This way we avoid having to hand off css file serving to ASP.NET.

share|improve this answer
How did you get the Intellisense working? I'm also using Chirpy but seems that it's just a normal CSS editor, doesn't recognize LESS syntax? –  jamiebarrow Aug 2 '11 at 12:28
@jamiebarrow I didn't get LESS syntax support, only CSS syntax support. If you find a way, please LMK. –  Adam Spicer Aug 4 '11 at 1:06
OK I misunderstood :) Thanks for clearing that up. Did look around but didn't find anything yet. IIRC the Chirpy plugin might provide it as some point? Hope so :) –  jamiebarrow Aug 4 '11 at 7:45
Also, I had Chirpy installed, but couldn't edit the .less.css file in a CSS editor, had to install CSS is LESS plugin to get that –  jamiebarrow Aug 4 '11 at 7:47
add comment

Your Answer


