1

I started today with LESS. It looks awesome to work with and I will need it on my internship soon.

My less code:

@color: #4D926F;

body {
    background-color: @color;
}

Not anything special.

My html:

<!Doctype HTML>
<html>
<head>
    <title>@ViewBag.Title</title>

    <link href="@Url.Content("~/Content/style.less")" type="stylesheet" rel="stylesheet/less" />
    <script src="@Url.Content("~/Scripts/less-1.4.1.min.js")" type="text/javascript"></script>

</head>
<body>
    @RenderBody()
</body>
</html>

The Less script file is downloaded from http://lesscss.org/

My file structure:enter image description here

The result:

FileError: 'http://localhost:58123/Content/style.less' wasn't found (404)
in style.less

Index

When I install dotless via Package Manager everything works perfect.

My question is what do I need to runn it without Dotles? I dont have problems installing Dotless or using it. I just want to know whats the missing link why the LESS gives that error. Why do I get a 404 error when the file is there?

JochemQuery
  • 1,495
  • 2
  • 26
  • 38

1 Answers1

0

Dotless compiles the .less to .css. So you would need to add a reference to the resulting .css that Dotless compiles. Also you would want to remove this line from your code.

<link href="@Url.Content("~/Content/style.less")" type="stylesheet" rel="stylesheet/less" /> 
BrianM
  • 173
  • 3
  • 14
  • If I delete that line, it doesn't work anymore. You say I should add the resulting css. Where can I find it? – JochemQuery Aug 20 '13 at 13:49
  • If I remember correctly it should compile out to the same directory as the .less, so in your case Content. If that's not the case, you can always follow [these instructions](https://github.com/dotless/dotless/wiki/Using-.less) and compile the .less outside of the project and then bring in the resulting .css into your project then reference it. – BrianM Aug 20 '13 at 13:57