4

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?

madth3
  • 7,275
  • 12
  • 50
  • 74
stoic
  • 4,700
  • 13
  • 58
  • 88

4 Answers4

4

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

<configuration>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"></modules>
    </system.webServer>
</configuration>
PCasagrande
  • 5,302
  • 3
  • 27
  • 36
2

have you tried accessing the Site.less file directly with your browser? If there is a syntax error in your less it will be output there..

If you get a 404 on that page the web.config is the problem, but I can't find anything wrong with it at the moment.

Are you running in Cassini or are you running on IIS7?

Tigraine
  • 23,358
  • 11
  • 65
  • 110
1

I'm not sure if this may be the cause, but in your link tag, rel value should be "stylesheet", not "stylesheet/css".

Also, I don't use ASP MVC but don't you need a tag around the Url.Content, like so?

<%= Url.Content("~/Content/Site.less") %>
T Nguyen
  • 3,309
  • 2
  • 31
  • 48
  • 1
    Regarding the tagging: he is using the Razor view engine which has a little different syntax than the <% %> of the WebForms view engine. – Matthew Nichols Jan 10 '12 at 16:55
-1

Have you tried setting the cache to false? On some machines I've had issues with it.

Mr. S
  • 1,469
  • 2
  • 15
  • 27