Unable to get a single LESS.js example to work.
I am testing both locally and on my server. My folder contains 2 files:
<!DOCTYPE HTML>
<html lang="en">
<head> <meta charset="UTF-8">
<title>Untitled Document</title>
<link rel="stylesheet/less" type="text/css" href="style.less">
<script src="http://lesscss.googlecode.com/files/less-1.0.18.min.js"></script>
</head>
<body>
<a href="#" class="myLESS_CSS">Submit</a>
</body>
</html>
@basic-color: #ff0000;
.myLESS_CSS{
background: @basic-color;
display: block;
width: 400px;
height: 100px;
margin: 50px auto;
font-family: helvetica,arial;
font-weight: bold;
font-size: 100px;
line-height: 100px;
text-align: center;
text-decoration: none;
text-shadow: 0px 2px 0px (@basic-color + #555);
color: #333;
}
Either locally or live the results look like this: http://www.leadminepond.com/tutorials/less/
When I enter "http://www.leadminepond.com/tutorials/less/style.less" in either IE9 or Chrome I get a 404 error saying the file does not exist, but it is in the folder. Any thoughts?
Thanks! John
Off the top of my head: could be that the server doesn't want to serve .less files (try renaming it to style.less.css and see if that works) or that its permissions are strange. Though the local testing of this should have worked. Is it locally, as in a server on your computer (http://localhost/...) or directly (file:///...)?
Hey SoulDreamer,
Thanks for the reply. My local testing has been http://localhost/html5_studies/less/ where less is the directory containing the two files mentioned above. Testing directly (file:///) yields the same results. Server is running Windows 2008, my local machine is running Windows 7.
I tried your suggestion of adding a '.css' extension but got the same results. Any other ideas?
Thanks again! John
Change the html page to include style.less.css instead of style.less, because your webserver serves that (if you try to access .../style.less it doesn't work, but .../style.less.css is served just fine). Sounds like it actually doesn't serve .less files (in which case, look for a tutorial on how to change that and give it the text/css (not sure this is the best/recommended, but it works for me with lighttpd) mimetype.
Hey SoulDreamer,
Thanks again for the reply. I have tried that, both locally and on the server but no luck in either IE9 or Chrome.
Thanks, John
Hi Ippdev,
Not sure if you still looking for the solution, in case you are, then try adding a new mimetype in IIS.
extension = .less
mimetype = text/css
Hi Ippdev - I have the same problem. Just started working with LESS, have test files which are quite happily showing up with styles in Safari and FF, just pointing browser at file:/// etc. IE9 and Chrome totally ignore the style. Installed IIS as I read (at http://stackoverflow.com/questions/3084892/less-js-not-working-in-chrome) that Chrome needed to understand LESS through a webserver. No difference. IE9 and Chrome are devoid of styles. Hope someone knows what might be happening here. ta folks
After another 26(!) minutes of research, I tried removing a previous attempt to get it to play with IE9 and Chrome, which was to add an absolute path to both the .less and the .js files in the html. I removed the absolute paths, and now both ie9 and Chrome show the styles properly, but only by browsing through localhost, not file:/// hth
Can anyone say what this bug is and what needs to be changed? I'm tempted to close it...
Looks like server error not being able to see .less files, I guess there's use of putting it on the client here rather than compiling and just pushing the css to the server. I'd suggest closing, no comments or bumps in 5 monhts cc @Ippdev @agatronic