开发者

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 Vie开发者_运维问答wEngine)

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?


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

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


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?


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") %>


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜