我在本地机器上设置了一个虚拟应用程序并且它正在运行,但它没有加载CSS文件。我正在使用lessCSS来为我的应用程序添加样式,我认为这里未能加载CSS的原因是LESSCSS样式表使用.less扩展名。
那么如何读取*.less文件扩展名呢?
.less
添加MIME类型(现在称为Internet Media Type),并将MIME类型设置为text/css
。Content-Type:text/html
头字段。这样,浏览器就可以理解使用哪个应用程序来处理响应体。HTTP请求
)。你点了一份披萨(披萨是扩展名)。厨师知道如何制作披萨,因此为您服务。Bomyhoor
。厨师不知道如何烹饪和服务这种食物。他/她问其他厨师是否已经有人在厨房里(厨房是Web服务器)知道如何烹饪?如果有人知道如何烹制Boomyhoor
,那么他/她会为您服务。Graboori
。厨师已从字典中了解到Graboori
只是披萨的另一个名称。因为他知道如何制作披萨,所以他就用披萨来代替。<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent >
示例:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent >
<rewrite>
<rules>
<rule name="WordPress: http://YourSite.com" patternSyntax="Wildcard">
<match url="*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<authentication mode="None" />
</system.web>
</configuration>
text/less
来解决我的406错误。 - deltree