无法让 dotLess 工作

发布于 2024-12-02 12:45:31 字数 1251 浏览 0 评论 0原文

我正在使用 dotLess

我遵循了他们的所有说明(看起来很简单),只有 4 个步骤:)

我的最小 web.config 如下所示:

<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>

我已在内容文件夹中添加了 .less 文件(我正在使用 ASP.NET MVC - Razor ViewEngine)

我的布局有一个指向我的 .less 包含文件的链接:

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

我还在我的 Web 应用程序中添加了对 dotless.Core.dll 的引用

然而,尽管当我将页面主体背景设置为黑色的简单样式时,什么也没有发生,由于某种原因它没有发挥作用。

我在这里错过了什么吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

药祭#氼 2024-12-09 12:45:31

您是否将 httphandler 设置为根据请求运行?添加这个:

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

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

<configuration>
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"></modules>
    </system.webServer>
</configuration>
轻许诺言 2024-12-09 12:45:31

您是否尝试过直接使用浏览器访问 Site.less 文件?如果你的 less 中有语法错误,它将在那里输出。

如果你在该页面上得到 404,则 web.config 就是问题所在,但我目前找不到任何问题。

您是在 Cassini 中运行还是在 IIS7 上运行?

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?

゛清羽墨安 2024-12-09 12:45:31

我不确定这是否是原因,但在链接标记中,rel 值应该是“stylesheet”,而不是“stylesheet/css”。

另外,我不使用 ASP MVC,但您不需要在 Url.Content 周围添加一个标记吗?像这样?

<%= Url.Content("~/Content/Site.less") %>

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") %>
眼波传意 2024-12-09 12:45:31

您是否尝试过将缓存设置为false?在某些机器上我遇到了问题。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文