我正在尝试在项目中使用DotLess,但遇到了一个似乎无法解决的问题。我正在尝试通过在我自己的自定义文件中使用 LESS 混合来扩展预先存在的 CSS 文件(实际上来自 JQuery UI)。
在 jquery-ui-1.8.20.custom.css 中:
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
以及我的 custom.less 文件的相关部分:
@import "./jquery-ui-1.8.20.custom.css";
.sortable-list li:hover {
.ui-state-hover;
}
当我尝试使用以下 DotLess 命令编译它时:
.\dotless-compiler -m [LESS_FILE_PATH]\custom.less .\custom.generated.css
我收到以下错误消息:
.ui-state-hover is undefined on line 92...
[91]: .sortable-list li:hover {
[92]: .ui-state-hover;
----^
[93]: }[Done]
a) 有谁知道我是否缺少命令行编译器的参数?(它的文档真的很好......)
b) 如果没有,LESS 是否存在一些无法处理我所描述的情况的固有缺点?扩展您无法触及的现有 CSS 文件似乎是一个非常常见的用例。