Hello-World Hello-World - 11 months ago 114
Less Question

Why LESS css does not work on localhost

According to this tutorial my less code should work but it doesn't.

Can you please help me to get my less css to work.

Right now it does not working - Page loads with no applied styles. What am I doing wrong?

The error is:

FileError: 'localhost:1/styles.less' wasn't found (404) in styles.less

But it is there in the root?

HTML

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title></title>
<link rel="stylesheet/less" type="text/css" href="styles.less">
<script src="_/script/less-1.4.1.min.js" type="text/javascript"></script>

</head>

<body>

<div id="header">test</div>

<h2>test h2</h2>

</body>

</html>


styles.less

LESS

@color: red;

#header {
color: @color;
}
h2 {
color: @color;
}

Answer Source

Thanks for your help everyone - turns out the answer is that my localhost did not serve the mime type .less

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download