Search code examples
cssasp.net-mvc-3dotless

Unable to get dotLess to work


I am using dotLess.

I followed all their instructions (which seems simple enough) it's only 4 steps :)

my minimal web.config looks like this:

<configuration>
  <configSections>
     <section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler,dotless.Core" />
  </configSections>
  <dotless minifyCss="false" cache="true" />
<system.web>
      <httpHandlers>
        <add type="dotless.Core.LessCssHttpHandler, dotless.Core" validate="false" path="*.LESS" verb="*" />
      </httpHandlers>
</system.web>
<system.webServer>
      <handlers>
        <add name="LessHttpHandler" type="dotless.Core.LessCssHttpHandler, dotless.Core" preCondition="integratedMode" path="*.less" verb="*" />
        </handlers>
</system.webServer>
  </configuration>

I've added my .less files in my content folder (i am using ASP.NET MVC - Razor ViewEngine)

my layout has a link to my .less include file:

<link rel="stylesheet/css" type="text/css" href="@Url.Content("~/Content/Site.less")" />

I have also added the a reference in my web application to dotless.Core.dll

Yet despite all of the when i do a simple styling of the page's body backround to black, nothing happens, for some reason it aint kicking in.

Am i missing something here?


Solution

  • Do you set the httphandler to run on requests? Add this:

    <configuration>
        <system.webServer>
            <modules runAllManagedModulesForAllRequests="true"></modules>
        </system.webServer>
    </configuration>