LESS CSS, @import path from variable

佐手、 提交于 2019-11-29 17:00:36

问题


I want to declare a variable with the path to the library:

@libPath: "any/path/to/lib";

And use it in @import. Something like this:

@import "@{libPath}/file.less";

And I see the result after processing:

@import url("@{libPath}/file.less");

No such possibility or am I doing something wrong?

Thanks.


回答1:


FWIW this is a bug in less.js that’s been discussed for way over a year now. There are at least two attempts to fix this but one requires large changes to the public API and has consequently been rejected. The other approach only works partially.

On the other hand, lessphp supports this without problem now; I have no idea whether dotless does.




回答2:


It isn't supported in less.js or dotless so I assume less PHP is the same. It might not be hard to add, why don't you add a feature request.

Also what is the problem you are trying to solve? Maybe it can be solved a better way.



来源:https://stackoverflow.com/questions/10676628/less-css-import-path-from-variable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!