LESS css变量不工作 [英] LESS css variable not working
问题描述
我是LESS的新人,我使用less.js作为我的开发环境。问题是,当我声明一个变量,它不工作,没有什么发生。
I am new to LESS and I'm using less.js as to my development environment. The problem is, when I declare a variable, it doest not working like nothing happen.
@bground: #c0c9c8;
body{
background-color: @bground;
}
正如你所看到的,@bground不会传递它的值。如果我把直接价值,它将证明.less是正确设置。我使用的是最新版本的Chrome,并在Mac上以本机方式执行。一切正常,除了变量。没有变量在工作,我不能使用LESS功能。
As you can see, the @bground does not pass it value. If I put direct value it will apear which is proof the .less is set up correctly. I'm using latest version of Chrome and running locally on Mac. Everything is working except variable. Without variables in work, I cannot use the LESS feature.
推荐答案
如果你使用apache,创建一个.htaccess文件你的根文件夹,如果你已经有一个,只需添加这一行:
If you`re using apache, create an .htaccess file in your root folder, if you already have one, just add this line:
AddType text/css .less
这将告诉apache为.less文件发送正确的内容类型头
This will tell apache to send the right content-type header for the .less file
这篇关于LESS css变量不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!