无法让 dotLess 工作
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您是否将 httphandler 设置为根据请求运行?添加这个:
Do you set the httphandler to run on requests? Add this:
您是否尝试过直接使用浏览器访问 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?
我不确定这是否是原因,但在链接标记中,rel 值应该是“stylesheet”,而不是“stylesheet/css”。
另外,我不使用 ASP MVC,但您不需要在 Url.Content 周围添加一个标记吗?像这样?
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?
您是否尝试过将
缓存
设置为false
?在某些机器上我遇到了问题。Have you tried setting the
cache
tofalse
? On some machines I've had issues with it.