为什么LESS css不能在localhost上工作 [英] Why LESS css does not work on localhost

查看:441
本文介绍了为什么LESS css不能在localhost上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此教程我较少的代码应该工作,但它不工作。

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

你能帮助我减少css工作。

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?

错误是:

FileError:'localhost:1 / styles.less '在styles.less中找不到(404)

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

但是它在根中有?

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

styles.less

LESS

@color: red;

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


推荐答案

原来的答案是,我的本地主机没有服务mime类型.less

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

这篇关于为什么LESS css不能在localhost上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆