LESS file does not load (404)

Diogo Cardoso picture Diogo Cardoso · Apr 7, 2011 · Viewed 30.4k times · Source

I'm using IIS 7.5 and I'm unable to load the less file because it gives a 404 error.

HTML:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>Less Tutorial</title>
        <link rel="stylesheet/less" href="style.less" />
        <script src="less-1.0.41.min.js"></script>
    </head>
    <body>        
        <div id="container">
            <a href="#">My Anchor</a>
        </div>
    </body>
</html>

LESS:

@primary_color: green;

#container {
    width: 200px;
    height: 200px;
    background: @primary_color;
}

Answer

Giorgio Bozio picture Giorgio Bozio · Mar 28, 2012

When using Asp.Net you can add the mime type in your web.config:

<system.webServer>
  <staticContent>
    <mimeMap fileExtension=".less" mimeType="text/css" />
  </staticContent >
</system.webServer>