智能感知上的文件.LESS [英] Intellisense on .LESS files

查看:243
本文介绍了智能感知上的文件.LESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我介绍 LESS 到现有的ASP.NET Web窗体应用程序。为了让智能感知工作,我决定成立 LessCssHttpHandler 拦截在 .less.css 。这样,Visual Studio中仍然认为,我们正在处理一个CSS文件。

:我加入下面一行到我的web.config文件中这样做

 <加上TYPE =dotless.Core.LessCssHttpHandler,dotless.Core
     验证=假路径=动词=*/&GT* less.css;

为了得到这个工作,我不得不调整我的IIS设置,使的.css 文件获取由ASP.NET框架处理。不幸的是,通过这样做,现在我现有的的.css 文件(因为他们没有在结束不是由带点HTTP处理程序处理。 less.css )不返回任何内容。这是有道理的,因为ASP.NET框架并不知道,当它看到与该扩展名的文件做什么。

是否有某种基地HTTP处理程序,我可以除了我有上述处理正常的.css 文件设置?是这样的:

 <添加动词=*路径= TYPE =在这里插入一些基本的HTTP处理程序,将直接返回文件的内容/&GT* CSS。


解决方案

貌似StaticFileHandler就是我一直在寻找。这就是我们结束了在web.config中它添加到我们的HttpHandlers的节点:

 <* less.css添加动词=*路径=验证=假TYPE =dotless.Core.LessCssHttpHandler,dotless.Core,版本= 1.1 .0.7,文化=中性公钥= 96B446C9E63EAE34,的ProcessorArchitecture = MSIL/>
<添加动词=*路径=* CSS。TYPE =System.Web.StaticFileHandler/>

I'm introducing LESS into an existing ASP.NET web forms application. In order to get intellisense to work, I decided to set up the LessCssHttpHandler to intercept requests for files ending in .less.css. That way, Visual Studio still thinks we're dealing with a CSS file. I did this by adding the following line to my web.config file:

<add type="dotless.Core.LessCssHttpHandler, dotless.Core" 
     validate="false" path="*.less.css" verb="*" />

In order to get this to work, I had to tweak my IIS settings so that .css files get handled by the ASP.NET framework. Unfortunately, by doing so, now my existing .css files (which aren't handled by the dotless HTTP handler since they don't end in .less.css) aren't returning any content. This makes sense since the ASP.NET framework doesn't really know what to do when it sees a file with that extension.

Is there some sort of base HTTP handler I can set up in addition to the one I have above to handle normal .cssfiles? Something like:

<add verb="*" path="*.css" type="insert some base HTTP handler here that will simply return the contents of the file" />

解决方案

Looks like the StaticFileHandler is what I was looking for. This is how we ended up adding it to our httpHandlers node in web.config:

<add verb="*" path="*.less.css" validate="false" type="dotless.Core.LessCssHttpHandler, dotless.Core, Version=1.1.0.7, Culture=neutral, PublicKeyToken=96B446C9E63EAE34, processorArchitecture=MSIL" />
<add verb="*" path="*.css" type="System.Web.StaticFileHandler" />

这篇关于智能感知上的文件.LESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆