本文介绍了LESS:类中的嵌套导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有很多少量的文件被导入一个主要的少量文件。该主文件包含一些包含十六进制颜色的不同变量。
I got a lot of less files that are imported into one main less file. That main file has some different variables containing hex-color.
例如:
@black: #333;
@green: #007f4b;
...
@import "layout";
@import "html";
...
可以用这个基础做一些事吗?
Is it possbile to do some thing with this base?
例如:
@black: #333;
@green: #007f4b;
@import: "layout";
@import: "html";
.fanshop {
@black: #111;
@green: green;
@import: "layout";
@import: "html";
}
结果应如下所示:
.headline {
background-color: #333;
}
.fanshop .headline {
background-color: #111;
}
这是否可能有更少的编译器?目前我使用lessphp。
Is this possbile with any less compiler? Currently I'm using lessphp.
谢谢!
推荐答案
这是可能在Less(不确定确切的版本,但最有可能从1.5.x),像这样:
It is possible in Less (not sure about exact version but most likely since 1.5.x), like this:
@black: #333;
@import "layout";
.fanshop {
@black: #111;
@import (multiple) "layout";
}
但是这不会在lessphp中工作,因为它稍微落后Less 1.4.x 。您可以尝试。
But that won't work in lessphp since it's somewhat behind Less 1.4.x. You could try less.php instead.
这篇关于LESS:类中的嵌套导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!